Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
i have a switch statment using DAX:
DisplaySEAData =
SWITCH(
TRUE(),
[SEA Selected],CALCULATE(SUM('EVR 2014-2024'[EVR]),'EVR 2014-2024'[office_name] = "SEA"),
"Test"
)
SEA Selected =
VAR SelectedCountries = VALUES('EVR 2014-2024'[office_name])
VAR CountSelectedCountries = COUNTROWS(SelectedCountries)
RETURN
IF (
CountSelectedCountries = 4 &&
COUNTROWS(FILTER(SelectedCountries, 'EVR 2014-2024'[office_name] IN {"Vietnam", "Philippines", "Indonesia","Thailand"})) = 4,
TRUE(),
FALSE()
)
In this scenario nothing is selected, so "test" is shown which is correct
However when the SEA countries are selected in the slicer, it returns blank but [SEA Selected] is already returning True as seen on the card on the left
I have also checked that CALCULATE(SUM('EVR 2014-2024'[EVR]),'EVR 2014-2024'[office_name] = "SEA") returns a value and not a blank
Can someone help me figure out what is wrong with my logic as to why its returning blank when it clearly is not?
Appreciate the help in advance
Solved! Go to Solution.
i found the issue, as i am selecting the slicer I.e. Vietnam,Indonesia, Thailand. i want to display the sum from SEA region instead but as it is filtered for Vietnam,Indonesia, Thailand it shows as blank() instead. i am now going to try and see if can do it if i change my data source to another table
Hi @rgoo, I'd suggest to debug in the following way:
DisplaySEAData =
VAR _SEA_Selected = [SEA Selected]
RETURN
SWITCH(
TRUE(),
_SEA_Selected,CALCULATE(SUM('EVR 2014-2024'[EVR]),'EVR 2014-2024'[office_name] = "SEA"),
"Test"
)
I hope something from it will help you! Good luck 🙂
i found the issue, as i am selecting the slicer I.e. Vietnam,Indonesia, Thailand. i want to display the sum from SEA region instead but as it is filtered for Vietnam,Indonesia, Thailand it shows as blank() instead. i am now going to try and see if can do it if i change my data source to another table
Great! Remember to acceprt the relevant asnwer as a solution when you finish, so others can find an answer to similar problem 🙂
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
146 | |
85 | |
66 | |
52 | |
47 |
User | Count |
---|---|
215 | |
90 | |
83 | |
66 | |
58 |