The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
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)
User | Count |
---|---|
65 | |
60 | |
55 | |
54 | |
31 |
User | Count |
---|---|
180 | |
88 | |
72 | |
48 | |
46 |