Forum Discussion
If Statement in DAX
- 9 years ago
Here are revised formula:
Display Quantity = if(OR(hasonevalue('Show Data By'[Show Data])=False ,values('Show Data By'[Show Data])="Qty"), SUM(Sales[Quantity]), BLANK()) Display Revenue = if(OR(hasonevalue('Show Data By'[Show Data])=False ,values('Show Data By'[Show Data])="Revenue"), SUM(Sales[Revenue]), BLANK())I used by own data coloumn, you can change it to your own. I tested at my end it works, if need with your own columns, i will do it for you.
- 9 years ago
I hope this will work:
Display Quantity = if(contains('Show Data By','Show Data By'[Show Data],"Qty"), SUM(Sales[Quantity]), BLANK()) Display Revenue = if(contains('Show Data By','Show Data By'[Show Data],"Revenue"), SUM(Sales[Revenue]), BLANK())
Here are revised formula:
Display Quantity = if(OR(hasonevalue('Show Data By'[Show Data])=False ,values('Show Data By'[Show Data])="Qty"), SUM(Sales[Quantity]), BLANK())
Display Revenue = if(OR(hasonevalue('Show Data By'[Show Data])=False ,values('Show Data By'[Show Data])="Revenue"), SUM(Sales[Revenue]), BLANK())
I used by own data coloumn, you can change it to your own. I tested at my end it works, if need with your own columns, i will do it for you.
- siddhantk9899 years ago
Helper III
The solution is working fine. thansk a lot parry2k for helping me out with this.
- parry2k9 years ago
Super User
Glad to hear and feel free to reach out to community for more questions.
Cheers!
- siddhantk9899 years ago
Helper III
Hi parry2k.
Need one last suggestion. Just now what we did was that if user was not selecting any value in the filter. What changes should I make in my code that if user selects both of the filters I should gata data for both sales and units? Right now if I select both Sales and Units in my code it is giving me the same error.
Thanks in advance.
Regards,
Siddhant