Forum Discussion
bestevezdyb
2 years agoFrequent Visitor
DAX SelectedValue With If
Good morning,
I would like to understand how to solve a problem that apparently is getting complicated. I have created a metric that is
NumberOfPizza =
VAR _qty = COUNTROWS( order_details )
RETURN
IF( _qty = BLANK(), 0, _qty)
And the next measure is
​
SelectedValue =
SELECTEDVALUE( order_details[pizza_id] )
SelectedValue =
SELECTEDVALUE( order_details[pizza_id] )
The result is as follow
How can I get the pizza type value to appear as a metric in the 0?
Thank you in advance
I think I have the solution
SelectedValue =VAR _qty = [NumberOfPizza]RETURNIF(_qty = 0,CALCULATE(MAX(order_details[pizza_id]), REMOVEFILTERS(DimDate)), -- Devuelve el valor de pizza_id si _qty es 0SELECTEDVALUE( order_details[pizza_id] ))
3 Replies
- FreemanZSuper User
hi bestevezdyb ,
not sure if i really get you, try like:
SelectedValue = SELECTEDVALUE( order_details[pizza_id], 0 )
- bestevezdybFrequent Visitor
- bestevezdybFrequent Visitor
I think I have the solution
SelectedValue =VAR _qty = [NumberOfPizza]RETURNIF(_qty = 0,CALCULATE(MAX(order_details[pizza_id]), REMOVEFILTERS(DimDate)), -- Devuelve el valor de pizza_id si _qty es 0SELECTEDVALUE( order_details[pizza_id] ))