Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Good Afternoon Everybody,
I am hoping that you can assist with a calculation error I am having. I am attempting to create a new column which will show
Solved! Go to Solution.
Hello @apowerbiguy ,
I'm not sure if I fully understood the requirements. I am checking for the value from the last quarter with identical BU and identical Fleet. Is that right?
I am just assuming the table is called MyTable. Try the following approach:
Previous =
VAR rowBU = MyTable[Bu]
VAR rowFleet = MyTable[Fleet]
VAR lastQuarter = DATEADD( MyTable[Date], -1, QUARTER )
VAR FilteredTable =
FILTER(
MyTable,
MyTable[Bu] = rowBU
&& MyTable[Fleet] = rowFleet
&& MyTable[Date] = lastQuarter
)
VAR AvailabilitytPQ = SUMX( FilteredTable, MyTable[Availability] )
RETURN
IF( MyTable[Availability] >= AvailabilitytPQ, "↑", "↓" )
If you need any help please let me know.
If I answered your question I would be happy if you could give it a thumbs up 👍!
Best regards
Denis
Hey @apowerbiguy ,
sure, VAR is just a variable and the result is always saved in the filtercontext when the variable is set. This I used to get the current context. The following video is explaining that:
https://www.youtube.com/watch?v=71ERlpfhmwU
Also check the article from SQLBI:
https://www.sqlbi.com/articles/variables-in-dax/
Best regards
Denis
Hello @apowerbiguy ,
I'm not sure if I fully understood the requirements. I am checking for the value from the last quarter with identical BU and identical Fleet. Is that right?
I am just assuming the table is called MyTable. Try the following approach:
Previous =
VAR rowBU = MyTable[Bu]
VAR rowFleet = MyTable[Fleet]
VAR lastQuarter = DATEADD( MyTable[Date], -1, QUARTER )
VAR FilteredTable =
FILTER(
MyTable,
MyTable[Bu] = rowBU
&& MyTable[Fleet] = rowFleet
&& MyTable[Date] = lastQuarter
)
VAR AvailabilitytPQ = SUMX( FilteredTable, MyTable[Availability] )
RETURN
IF( MyTable[Availability] >= AvailabilitytPQ, "↑", "↓" )
If you need any help please let me know.
If I answered your question I would be happy if you could give it a thumbs up 👍!
Best regards
Denis
Thank you! This is perfect and worked, I am looking to learn more about VAr do you have any recommendations for where to learn more?
Thank you again for the help!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
112 | |
97 | |
84 | |
67 | |
60 |
User | Count |
---|---|
150 | |
120 | |
99 | |
87 | |
68 |