The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hello !
Im trying to change and old DAX that is not working anymore due to the year change, the last analyst didn´t considered year change.
So my ideia is to use SELECTEDVALUE as a variable on the formula, so it doesn´t need to be changed every year, heres the code:
Solved! Go to Solution.
@Anonymous
I don't think you can just use selectedvalue() directly on the current table. Try following:
1. create a new table with year column, more years if needed.
2. You do not need VAR Year, remove it. And change the return formula:
Return
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
@Anonymous
I don't think you can just use selectedvalue() directly on the current table. Try following:
1. create a new table with year column, more years if needed.
2. You do not need VAR Year, remove it. And change the return formula:
Return
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
Thanks ! That actually worked 🙂
@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
@Anonymous , Is this you actual formula or I doubt. Why so many var when you are not using them ?
This formula seem correct. Best way to test is
SWITCH(TRUE(),
YEAR = 2019, 1,
YEAR = 2020, 2
)
Check what value it returns
Post that return A , B and E one at time and check what is wrong. May be one formula have some issue
@amitchandak Hi!
yes, its my formula, i have this many variables just for now, i will try to fix them later, since i didn´t manage to make the first part of DAX to work, i plan to make them more easy to manipulate, most of these are year specifically formulas.
I´ve tried your advice but it didn´t seems to work 😞
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
137 | |
106 | |
101 | |
74 | |
59 |
User | Count |
---|---|
260 | |
126 | |
115 | |
98 | |
87 |