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.
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 FactTable
Monthly 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
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.
- Anonymous1 year agoNot applicable
Hi ThisIsBlecki ,
May I ask if you have resolved this issue? If so, please mark the helpful reply and Accept it as the solution and give a 'Kudos'. This will be helpful for other community members who have similar problems to solve it faster.
Thank you
- ThisIsBlecki1 year agoFrequent Visitor
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.