Forum Discussion
if then else
- 9 years ago
Cool my dear friend.
We can do anything in DAX cool.
Try this,
Measure =
Switch ( True(),
condition1,"Result1" ,
condition1,"Result1" ,
etc... )
let me if any help in DAX.
Cool my dear friend.
We can do anything in DAX cool.
Try this,
Measure =
Switch ( True(),
condition1,"Result1" ,
condition1,"Result1" ,
etc... )
let me if any help in DAX.
- B_Real9 years agoAdvocate IV
Measure = Switch ( True(), condition1,"Result1" , condition1,"Result1" , etc... )
Yaas! Great shout on Switch()! I don't think I need need the True() function here tho, the Switch() function seems to take care of everything:
SWITCH(<expression>, <value>, <result>[, <value>, <result>]…[, <else>])
Also cheers for pointing out difference between DAX and M. Here's a link that describe the difference in more detail:
Essentially:
First you use M to query data sources, clean and load data. Then you use DAX to analyze & visualise the data in Power BI.
- MarcelBeug9 years agoCommunity Champion
So as a rule of thumb: :smileylol:
if extract then M if transform then (if not aggregate then M else DAX) else DAX
- Ramakrishna7 years agoRegular Visitor
Hi Bhaskar,
can you help me with this query how to achive with DAX.
IF [repair information ] = "Repeat Repair"
THEN
IF COUNTD([VIN]) / TOTAL(COUNTD([VIN])) > 0.1
THEN round(COUNTD([VIN]) / TOTAL(COUNTD([VIN])),4) ENDELSE
IF COUNTD([Strata Claim Id]) / TOTAL(COUNTD([Strata Claim Id])) > 0.1
THEN round(COUNTD([Strata Claim Id]) / TOTAL(COUNTD([Strata Claim Id])),4) ENDEND
any quick response would be appriciated.
Regards,
Ram.
- Anonymous7 years agoNot applicable
I tried to use the above query but not excusted.
I wanted to split the condition into the three different statement.
- Avg time from purchase request[PR->DATE1] to Inquiry floated to supplier(active request)[TENDER->DATE3] (days)
- Avg time from {Inquiry floated to supplier}[TENDER->DATE3] to {Commercial approval done [TENDER->DATE10] (days)}
- Average time from Commercial approval done[TENDER->DATE10] to PO issue [PO->DATE4](days).
- Anonymous4 years agoNot applicable
For this, I think we can use a case statement how we use in SQL
- Anonymous7 years agoNot applicable
I am trying to write this if statement in dax but i am not getting the result can you please help me out
Forecast Category II = IF(DSAPJ_Opportunity[Forecast Category]="Open",IF((DSAPJ_Opportunity[Forecast Category]="Pipeline" & DSAPJ_Opportunity[Sales Stage1] IN {"01","02","03","04A","04B","05","06"},"Pipeline",IF(DSAPJ_Opportunity[Forecast Category]="Upside" & DSAPJ_Opportunity[Sales Stage1] IN {"04A","04B","05"},"Upside",IF(DSAPJ_Opportunity[Forecast Category]="Commit" & DSAPJ_Opportunity[Sales Stage1] IN {"04A","04B","05"},"Commit",IF(DSAPJ_Opportunity[Forecast Category]="Won" & DSAPJ_Opportunity[Sales Stage1] = "06" , "Won","DQ Issues"))))))
- rpsathish36 years agoNew Member
Thank You !