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 August 31st. Request your voucher.
Hi all,
Can you guide me to create a dax formula for getting month on month change ? I can use calculate(sum, previousmonth(date)) function. but my requirement is slightly differenct.
Actually, I want to find out change in the last week of the each month; like below, I have a table where weekly data is reflecting, I want to find change % of last week of Nov data vs last week of October data then last week of Oct vs last week of September.
Date Value
04/09/2022 | 13 |
11/09/2022 | 54 |
18/09/2022 | 23 |
25/09/2022 | 44 |
02/10/2022 | 55 |
09/10/2022 | 32 |
16/10/2022 | 67 |
23/10/2022 | 33 |
30/10/2022 | 68 |
06/11/2022 | 23 |
13/11/2022 | 56 |
20/11/2022 | 89 |
27/11/2022 | 65 |
04/12/2022 | 43 |
Thanks
Solved! Go to Solution.
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
For week-based calculations you need a weekly calendar like, say, ISO-week. Please have a look at this: Week-related calculations – DAX Patterns
your code is giving the answer, but when I make a relationship with calender table and then replaced date column used in the code with calender date column, it is not working.
I used different code as well which worked with same data set and gave the required result. Again, when I made relationship with calender table then not working. Do not know why ?
One more thing to add, in my source file, there are some repeated dates as well.
Hi @CNENFRNL ,
Thanks for the help. I just modified a little to get my required result. It is giving the correct answer.
I got a few questions after going through the attached pbix file and your code. Could you please help help me understand why it is happening ?
1) In the table, where you have created a column (
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
Hi @CNENFRNL ,
Thanks for responding, however, the the value is incorrect.
in the data, last week of Sep (25/09/2022) value is 44 and last week of Oct (30/10/2022) value is 68, so the % change should reflect Sep vs Oct (55%).
And then last week of Oct (30/10/2022) value 68 vs last week of Nov (27/11/2022) value 65, % change should reflect (-4%).
Thanks!
Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension! |
DAX is simple, but NOT EASY! |
User | Count |
---|---|
25 | |
12 | |
8 | |
8 | |
7 |
User | Count |
---|---|
27 | |
12 | |
12 | |
12 | |
6 |