Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code FABINSIDER for a $400 discount.
Register nowGet inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.
Dear friends, how are you?
Along with saying hello, I'd like to make a query about the DAX formula I wrote for a Dynamic Title, where based on a certain MONTH and YEAR, it gives me a certain value, so I used SWITCH(TRUE() and & &.
The DAX formula would be:
Title 2024 = "2024 Budget Data
EUR = USD = 938 CLP
UF = "&SWITCH(TRUE(),
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="1",36000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="2",36500,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="3",37000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="4",37500,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="5",38000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="6",38500,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="7",39000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="8",40000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="9",40500,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="10",41000,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="11",41500,
SELECTEDVALUE('Budget'[ppto.]) =2024 && SELECTEDVALUE('Budget'[Month Ppto.]) ="12",42000,"")&" CLP"
However, when I enter the DAX on a card, I get the blank result (UF = "" CLP) if I select Year 2024 and month 1.
When you are looking for:
2024 budget data
EUR = USD = 36000 CLP
As a matter of fact, the year column is an integer and month is a text.
Best regards!
@Syndicate_Admin create two dummy measure and put those on Card visual and see what value you get, it is hard to debug, so these new visual will help to understand why the switch statement is not working:
Selected Year = SELECTEDVALUE('Budget'[ppto.])
Selected Month = SELECTEDVALUE('Budget'[Month Ppto.])
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
No, they are months and year separated in different columns (that's why the month appears text and year as an integer, it was a configuration that I prefer to leave it like that so as not to alter the results of the report because it comes)
@Syndicate_Admin what you are using in the slicer? Are you using the in-built hierarchy column from the date column?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!
Check out the February 2025 Power BI update to learn about new features.
User | Count |
---|---|
126 | |
113 | |
72 | |
65 | |
46 |