Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hey guys,
I'm currently having somewhat of an issue at the moment:
I have a landings page for a company, they have several KPI's calculated there and are sliced by Month&Year on graphs.
Next to it is a KPI which shows comparison of this month's value in comparison to last month's one.
Now if no specific month is selected for an argument, Power BI calculates the total of all months etc, which is not intended.
So what's it they want:
A kpi (could be a card) that puts this Month's figure vs the Last one, if none are selected take the values for the latest Month:
Example of a KPI's code:
AffectedArticlesMonth = CALCULATE(
SUMX(FILTER(F_ComplaintTicket;[Quantity] >= 0); F_ComplaintTicket[Quantity]);
DATESBETWEEN(D_FilteredDate[DateFull].[Date];
FIRSTDATE(D_FilteredDate[DateFull].[Date]);
LASTDATE(D_FilteredDate[DateFull].[Date]));ALL(D_FilteredDate)
)
vs
AffectedArticlesLastMonth = CALCULATE(
SUMX(FILTER(F_ComplaintTicket;[Quantity] >= 0); F_ComplaintTicket[Quantity]);
DATESBETWEEN(D_FilteredDate[DateFull].[Date];
FIRSTDATE(DATEADD(D_FilteredDate[DateFull].[Date]; -1; MONTH));
LASTDATE(DATEADD(D_FilteredDate[DateFull].[Date]; -1; MONTH)));ALL(D_FilteredDate))
Now i've tried using the following:
CALCULATE([AffectedArticlesMonth];FILTER(D_FilteredDate;MAX(D_FilteredDate[MonthId])))
But DAX can't take Measures into it's expression:
The way i created a Title that does do the intended behaviour:
KPITitle =
VAR MaxMonthSeqNo = CALCULATE(MAX(D_FilteredDate[MonthId]))
Return LOOKUPVALUE(D_FilteredDate[MonthNameEn];D_FilteredDate[MonthId];MaxMonthSeqNo) & " " & LOOKUPVALUE(D_FilteredDate[YearId];D_FilteredDate[MonthId];MaxMonthSeqNo)
So if anyone has any ideas that can push me into the right direction, that'd be amazing.
Thanks in advance.
In this scenario, since your KPI is a measure, to show the last month's KPI measure, you can use DATEADD() function. The formula can be like:
Last Month KPI= CALCULATE([kpi measure], DATEADD(Table[Date],-1,MONTH))
Regards,
So in essence, your're forcing the measure to be sliced for a particular combination of Month.
The underlying variables can be ranging dates from a year to quarter aggregations.
I'll test this out later today if i get the chance it looks promising so far.
My regards in advance.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 192 | |
| 125 | |
| 99 | |
| 67 | |
| 48 |