Forum Discussion
Anonymous
4 years agoNot applicable
DAX Calculation with multiple rules
Hi there, I am looking create a measure "Quote Waiting Customer Review" with multiple rules. The rules are below. CANCELLED is a date field. INVOICED is a date field. LGI_MAINTENANCE is a date...
- 4 years ago
Anonymous did you copy and paste my code into your PBIX and just change the table name from 'Table' to whatever your table is called?
TheoC
4 years agoCommunity Champion
Hi Anonymous
You can use the SWITCH function to achieve this.
New Measure =
VAR _StatusDate = SELECTEDVALUE ( 'Calendar'[Date] )
RETURN
SWITCH (
TRUE () ,
'Table'[CANCELLED] = "" || 'Table'[CANCELLED] >= _StatusDate , 1 ,
'Table'[INVOICED] = "" || 'Table'[INVOICED] >= _StatusDate , 1 ,
'Table'[LGI_MAINTENANCE] = "" || 'Table'[LGI_MAINTENANCE] >= _StatusDate , 1 ,
'Table'[SENT_TO_MIN] = "" || 'Table'[SENT_TO_MIN] >= _StatusDate , 1 ,
'Table'[COMPLETED] = "" || 'Table'[COMPLETED] >= _StatusDate , 1 ,
'Table'[ACCEPTED] = "" || 'Table'[ACCEPTED] >= _StatusDate , 1 ,
'Table'[QUOTED] < _StatusDate , 1 ,
0 )
Using the above, you can then COUNTROWS / FILTER = 1 on the above.
Hope this helps 🙂
Theo
Anonymous
4 years agoNot applicable
Hi Theo,
Thanks for your reply.
'Table'[Cancelled] 'Table'[Invoiced] etc, are all dates in the same table.
How when i write the DAX i cant seem to select or find the these fields?
Thanks
- TheoC4 years agoCommunity Champion
Anonymous did you copy and paste my code into your PBIX and just change the table name from 'Table' to whatever your table is called?
- Anonymous4 years agoNot applicable
Yeah I did
- TheoC4 years agoCommunity Champion
Anonymous can you screen shot what the measure you used?