March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
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!
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
119 | |
88 | |
74 | |
67 | |
49 |
User | Count |
---|---|
206 | |
143 | |
97 | |
79 | |
68 |