DAX in Power Pivot - Replacing -> SELECTEDVALUE

Guinaba

Board Regular
Joined
Sep 19, 2018
Messages
233
Office Version
  1. 2016
Platform
  1. Windows
Hi guys,

Any suggestion on how I can replace SELECTEDVALUE on the expression below to be used in Power Pivot?

Week Product Group Accuracy % := 1 -
(
SUMX (
SUMMARIZE (
IBPData,
IBPData[Product Group ID],
IBPData[Week Start],
"Actuals", SUM ( IBPData[Sales] ),
"Stat Adjusted", SUM ( IBPData[Stat Adjusted] ),
"Final for Weekly", sum( IBPData[Final for Weekly] ),
"4wk Lag", SUM ( IBPData[4wk Lag Forecast] ),
"13wk Lag", sum( IBPData[13wk Lag Forecast] ),
"Latest Plan M-1", SUM ( IBPData[Latest Plan M-1] ),
"IBP Plan M-3", sum(IBPData[IBP Plan M-3])

),
ABS (
[Actuals]
-
Switch( True(),
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 0,
[Stat Adjusted],
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 1,
[Final for Weekly],
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 2,
[4wk Lag],
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 3,
[13wk Lag],
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 4,
[Latest Plan M-1],
SELECTEDVALUE('Forecast Version'[Switch Number] ) = 5,
[IBP Plan M-3]

)
))
/ SUM ( IBPData[Sales] )

)
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
By definition, SELECTEDVALUE only works when there is a single value. As a result, you can use any other aggregation measure and it will work. MIN, MAX, AVERAGE, SUM, they will all work.

Alternatively, SELECTEDVALUE is shorthand for
If(hasonevalue(table[column]),values(table[column]))
So you can use that.

Also, you can simply your switch statement

Switch( SELECTEDVALUE('Forecast Version'[Switch Number] )
0,[Stat Adjusted],
1,[Final for Weekly],
2,[4wk Lag],
3,[13wk Lag],
4,[Latest Plan M-1],
5,[IBP Plan M-3]

)
 
Upvote 1
Solution

Forum statistics

Threads
1,223,164
Messages
6,170,438
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top