Forum Discussion
Wrong Value for Rolling/KPI When Adding Time to Visual
- 1 year ago
Hi Anonymous ,
Unfortunately, it didn’t work. Power BI applies a strange time filter that I can’t make sense of. Unfortunately, I can’t find a solution without Tabular Editor and DAX Studio.
I’ve moved the entire calculation logic to the data warehouse.
Thanks for your help, and sorry for the late reply — I was away.
One additional consideration: it looks like some cases post positive TG adjustments in one month and negative adjustments in another, effectively canceling each other out over the rolling window. That means a case may be “active” in one monthly snapshot but “inactive” in another, which can lead to unexpected fluctuations in the per‐month distinct‐count even though the overall total remains correct.
And if a case’s positive and negative TG adjustments exactly cancel each other out over the rolling window (net sum = 0), that case should be completely excluded from the distinct‐count—it should not be counted as active in any monthly snapshot.
- Anonymous1 year agoNot applicable
Hi ThisIsBlecki ,
Thanks for reaching out to the Microsoft fabric community forum.Create this using DAX:
DimDate =
ADDCOLUMNS(
CALENDAR(DATE(2021,1,1), DATE(2024,6,30)),
"YearMonth", FORMAT([Date], "YYYY-MM")
)Create the relationship.
Drag FactTable[Date] onto DimDate[Date] to create the relationship.
Right-click DimDate → Mark as Date Table → select Date.
Add DAX Measures
Add New Measure to FactTableMonthly KPI :
Monthly KPI :=
CALCULATE(
SUM(FactTable[Value]),
FactTable[IndicatorCode] = "SOME_INDICATOR",
FactTable[OrgCode] = "SomeOrg"
)YTD KPI :
YTD KPI :=
TOTALYTD(
[Monthly KPI],
DimDate[Date]
)Rolling 12M KPI :
Rolling 12M KPI :=
CALCULATE(
[Monthly KPI],
DATESINPERIOD(
DimDate[Date],
LASTDATE(DimDate[Date]),
-12,
MONTH
)
)Rolling Distinct Count of Cases :
Rolling Distinct Cases :=
CALCULATE(
DISTINCTCOUNT(FactTable[CaseID]),
DATESINPERIOD(
DimDate[Date],
LASTDATE(DimDate[Date]),
-12,
MONTH
)
)Create Visuals:
A. Card Visual
Add Rolling 12M KPI.
It shows the current 12-month rolling value.
B. Matrix Visual (to show per month)
Rows: DimDate[YearMonth]
Values: Rolling 12M KPI, Monthly KPI, YTD KPI.
If the response has addressed your query, please Accept it as a solution and give a'Kudos' so other members can easily find it.
Best Regards,Sreeteja.
Community Support Team- Anonymous1 year agoNot applicable
Hi ThisIsBlecki ,
Just wanted to check if you had the opportunity to review the suggestion provided?
If the response has addressed your query, please Accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.
- Anonymous1 year agoNot applicable
Hi ThisIsBlecki ,
I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please Accept it as a solution so that other community members can find it easily.