Forum Discussion

RenateBK's avatar
RenateBK
Icon for Helper II rankHelper II
6 months ago
Solved

KPI measurement includes future months with no data, how do I filter out future months?

Hello, 

 

I am struggling as I my KPI measure keeps including the whole month by default (works perfectly when filtered). I am using a fabric set up, so I am currently stuck using a full time date table with 10 years into the future which makes the time data functions a bit finnicky at times. I have tried a variety of time filtering, but I cannot seem to provide the correct filter as my percentage change (same period last year) stays inflated). 

 

I have tried a MAX filtering:

VAR _Dates = DATESYTD(dim_date[full_date])
RETURN IF (MAX(
    dim_date[full_date])
    <=DATE(
        YEAR(TODAY()),
        MONTH(TODAY()),
        1), CALCULATE(SUM(table[CASES]),_Dates)
)
However this just returns a 0 on the KPI card which I assume is because it's DATESYTD. 
 
Currently I am using a simple:
 
Sum Cases=
SUM(table[CASES])
 
Same period last year =
 VAR _FY = CALCULATE([Sum Cases], SAMEPERIODLASTYEAR(dim_date[full_date]))
 VAR _PERC = DIVIDE([Sum Cases]-_FY , _FY)
 VAR _Format =
 SWITCH(
    TRUE(),
    _perc > 0.0, UNICHAR(11165)  & " " & FORMAT(_perc,"0.0%"),
    _perc < 0.0, UNICHAR(11167) & " " & FORMAT(_PERC*-1, "0.0%"),
    FORMAT(_perc,"0.0%"))

 RETURN
 _Format
 

however the percentage change is taking all of 2026 and comparing it to all of 2025 when there is no filter applied, which will cause confusion amongst the stakeholders.

 

Please help me with limiting the data so the KPI doesn't go further than at least the current month, preferably doesn't compare time periods with no data.

  • Add a relative date filter to the visuals so that dim_date[full_date] is in this day. Then change SAMEPERIODLASTYEAR to be SAMEPERIODLASTYEAR( DATESYTD( dim_date[full_date] ) ).

2 Replies

  • Add a relative date filter to the visuals so that dim_date[full_date] is in this day. Then change SAMEPERIODLASTYEAR to be SAMEPERIODLASTYEAR( DATESYTD( dim_date[full_date] ) ).

    • RenateBK's avatar
      RenateBK
      Icon for Helper II rankHelper II

      Thank you so much for the advice, I was not aware of relative date filters and this is such a game changer for me. 

       

      For others who want to learn about relative date filters and accidentally stumbled upon this thread, this is a short and sweet tutorial https://www.youtube.com/watch?v=jgTmRPiAQP0