Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hi, I would like to calculate the measure [Warranty CPTV] for last month for a year selected from slicer.
If previous year is selected, the measure should show december value.
If current year is selected and we would be in January, I want the measure to show (blank).
If current year is selected and we would be between Feb-Dec, the measure should show previous month value.
I have a calendar table with year-month key (for example '202201' for all dates in Jan 2022) and month offset column (difference in months between current month and month for the calendar day).
So far, I've come up with this measure:
Thanks a lot - this is guiding me in the right direction. I have used this measure for last month value:
Warranty CPTV PM = CALCULATE( [Warranty CPTV] , previousmonth('Calendar'[Date] ) )
It works fine, but I have one more ask: how to show previous month at the Total level?
Hi @Krzysztof_Hyla
You could use this measure;
Measure 1=CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
Measure 2=
Hi Thennarasu_R, the Measure 2 you provided will give me a sum as a total value, but I don't want to sum the values - I want to retrieve the value for last month.
Unless I'm doing something incorrectly
Hi @Krzysztof_Hyla
ok use this one,
Measure 1=Calaculate(Sum(Sales(Sales))
Meassure 2=If(Hashonefilter(Product name),Measure 1,CALCULATE( [Warranty CPTV] , previousmonth('Calendar'[Date] ) )
Thanks,
Thennarasu
@Krzysztof_Hyla , You can use a date table and time intelligence
example
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last month Sales = CALCULATE(SUM(Sales[Sales Amount]),previousmonth('Date'[Date]))
Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s
or try offset
Power BI Offset Compare Categories, Time Intelligence MOM, QOQ, and YOY: https://youtu.be/5YMlkDNGr0U
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
87 | |
87 | |
84 | |
66 | |
49 |
User | Count |
---|---|
127 | |
109 | |
93 | |
70 | |
67 |