Forum Discussion
RingoMoon
2 years agoFrequent Visitor
Need ideas optimizing a long measure
Contacts roles per Org Prior =
VAR SelectedEditions = VALUES(opp_data[eventname])
VAR Result =
SUMX(
SelectedEditions,
VAR SelectedEvent = opp_data[eventname]
VAR Select...
Anonymous
2 years agoNot applicable
Hi RingoMoon ,
You mean you don't want LastNonBlankEdition to be null but a fixed value even if eventname's slicer doesn't have any value selected, right?
Then you can use the MAX function instead of the SELECTEDVALUE function, the difference is that the MAX function will not be null when there is no selected value in the slicer.
Then you can modify the DAX function to:
...
VAR SelectedEvent = MAX(opp_data[eventname])
VAR SelectedEdition = SELECTEDVALUE(opp_data[eventeditioncode])
VAR LastNonBlankEdition =
CALCULATE(
MAX('Prior Editions'[PriorEdition]),
opp_data[eventname] = SelectedEvent
)
...
Or, you could just write that the variable LastNonBlankEdition is assigned a fixed value if it is null. I think the IF function would be helpful. Then you could modify the DAX function to:
...
VAR SelectedEvent = SELECTEDVALUE(opp_data[eventname])
VAR SelectedEdition = SELECTEDVALUE(opp_data[eventeditioncode])
VAR LastNonBlankEdition =
IF(ISBLANK( SELECTEDVALUE('Prior Editions'[PriorEdition])),2,SELECTEDVALUE('Prior Editions'[PriorEdition])) //Here I assume that the fixed value is 2
...
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.