Earn recognition and rewards for your Microsoft Fabric Community contributions and become the hero our community deserves.
Learn moreBecome a Certified Power BI Data Analyst! Prepare for Exam PL-300 with expert-led live sessions. Get registered!
Hi Community,'
I have written below measure to get the previous month amount, but it results blank value always.
Previous Month Amount =
CALCULATE(
MAX(Data[Amount]),
PREVIOUSMONTH((Data[Promished Ship Date]))
)+0
Visual
Thanks,
Bhimashankar
You can download the file from here Previous Month Power BI file
Solved! Go to Solution.
Hi @Bhimashankar_D , I have fixed the previous month amount calculation in this file Download PBIX
I have considered the maximum month available in the data and not today's date, In your case it is December so the the previous month sales will be of november 2023.
Output:
Did I answer your question ? If yes, please mark my post as a solution.
Thanks,
Jai
Proud to be a Super User! | |
Hi @Bhimashankar_D ,
You need to create a calendar table:
And create a relationship with the 'Data' table via [Date].
Use the columns in the calendar table to build the hierarchy instead of Auto date/time.
Now you can pick the comparison pattern that suits you.
Page1:
PM Amount = CALCULATE(SUM('Data'[Amount]), DATEADD('Date'[Date], -1 , MONTH))
Page2:
PM Amount2 =
VAR __curr_period = SELECTEDVALUE('Date'[Year Month Key])
VAR __prev_month_amount = CALCULATE( SUM('Data'[Amount]), REMOVEFILTERS('Date'), 'Date'[Year Month Key] = __curr_period - 1 )
RETURN
IF( NOT ISBLANK(__curr_period), __prev_month_amount )
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Hi @Bhimashankar_D ,
You need to create a calendar table:
And create a relationship with the 'Data' table via [Date].
Use the columns in the calendar table to build the hierarchy instead of Auto date/time.
Now you can pick the comparison pattern that suits you.
Page1:
PM Amount = CALCULATE(SUM('Data'[Amount]), DATEADD('Date'[Date], -1 , MONTH))
Page2:
PM Amount2 =
VAR __curr_period = SELECTEDVALUE('Date'[Year Month Key])
VAR __prev_month_amount = CALCULATE( SUM('Data'[Amount]), REMOVEFILTERS('Date'), 'Date'[Year Month Key] = __curr_period - 1 )
RETURN
IF( NOT ISBLANK(__curr_period), __prev_month_amount )
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data in the Power BI Forum
Thanks for solution. It helps alot!
Thanks,
Bhimashankar
Hi @Bhimashankar_D , I have fixed the previous month amount calculation in this file Download PBIX
I have considered the maximum month available in the data and not today's date, In your case it is December so the the previous month sales will be of november 2023.
Output:
Did I answer your question ? If yes, please mark my post as a solution.
Thanks,
Jai
Proud to be a Super User! | |
Thanks @Jai-Rathinavel for solution and sharing the file. But how did you changed the 'Promished Ship Date' to normal date thing, it was date hierarchy.
Also one more thing, if have to get the previous month amount how it will bheave when selected month(this will be filter) is Jan 2023 now previous month becomes Dec 2022 ?
@Bhimashankar_D , I turned off Auto Time intelligence on the file settings
Proud to be a Super User! | |
Thank you very much!
User | Count |
---|---|
81 | |
68 | |
56 | |
53 | |
47 |
User | Count |
---|---|
52 | |
49 | |
39 | |
32 | |
32 |