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.
Hi! I'm having some trouble understanding DAX syntax when it comes to differences between rows. I want to accomplish this in its own column for a matrix...
if ('Table'[Date].[Year] - 1 == EARLIER('Table'[Date].[Year]) AND 'Table'[Type] == EARLIER('Table'[Type])):
new_column = 'Table'[TypeCount] - EARLIER('Table'[TypeCount])
else:
new_column = 0
Does that make sense? I'm having some real problems translating this to DAX. My confusion is especially in the EARLIER() expression, and I'm a tad confused which expression I should be using in the first place to get this if statement working. Should I maybe use CALCULATE()? IF()? Just having some trouble with the new syntax.
To elaborate further, my goal is to get the difference between two dates based on the count of the type. So for instance if April 2015 "new" types had a count of 2, and April 2016 "new" types had a count of 4, I would have a column with the difference between these two values (2) that shows the change over time.
Solved! Go to Solution.
After some headscratching I came up with a solution that seems to be working... here it is for those who have similar problems!
Year Delta = IF(LOOKUPVALUE('Signings and Losses'[TypeCount],'Signings and Losses'[DateSum],[LastDateSum],'Signings and Losses'[Type],'Signings and Losses'[Type])>0,
'Signings and Losses'[TypeCount] - LOOKUPVALUE('Signings and Losses'[TypeCount],'Signings and Losses'[DateSum],[LastDateSum],'Signings and Losses'[Type],'Signings and Losses'[Type])
, 0)
After some headscratching I came up with a solution that seems to be working... here it is for those who have similar problems!
Year Delta = IF(LOOKUPVALUE('Signings and Losses'[TypeCount],'Signings and Losses'[DateSum],[LastDateSum],'Signings and Losses'[Type],'Signings and Losses'[Type])>0,
'Signings and Losses'[TypeCount] - LOOKUPVALUE('Signings and Losses'[TypeCount],'Signings and Losses'[DateSum],[LastDateSum],'Signings and Losses'[Type],'Signings and Losses'[Type])
, 0)
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 |
---|---|
110 | |
94 | |
80 | |
67 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |