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 All,
I am trying to do something in DAX that I can easily do with Excel (show value as difference from previous "x"). In this case, I have a column of Week Numbers with their respective Widget Counts for that week number. In Excel, I can drop into the pivot table and ask it to show me the value difference from the previous week number (regardless of whether it's a date or not). Image below:
I tried something to the effect of:
Solved! Go to Solution.
@lfrosales add following measure
WoW Widget = VAR __prevWeek = MAX( Table1[Week] ) - 1 VAR __thisWeekWidget = SUM( Table1[Widgets] ) VAR __prevWeekWidget = CALCULATE( SUM( Table1[Widgets] ), Table1[Week] = __prevWeek ) RETURN __thisWeekWidget - __prevWeekWidget
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@lfrosales add following measure
WoW Widget = VAR __prevWeek = MAX( Table1[Week] ) - 1 VAR __thisWeekWidget = SUM( Table1[Widgets] ) VAR __prevWeekWidget = CALCULATE( SUM( Table1[Widgets] ), Table1[Week] = __prevWeek ) RETURN __thisWeekWidget - __prevWeekWidget
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Thank you so much! I was struggling a couple hours on something that seemed super straightforward and you proved that it was! In my delirium, I accidentally tried adding it as a calculated column and wasn't having any luck, then I realized that you said as a measure! Worked like a charm! The only quirk I will try to work out is that it looks at week 1 of the year and gives it a value equal to that week's widget count. I will try to figure out a way to tell it to ignore Week 1 and continue with the rest.
See below:
User | Count |
---|---|
14 | |
12 | |
7 | |
6 | |
5 |
User | Count |
---|---|
28 | |
19 | |
13 | |
7 | |
5 |