Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

KPI visual target help

I am using the default KPI visual, but am having trouble with a calculated target value. I am using YTD costs for the indicator and fiscal year for the trend. I would like to use the average costs over the last five years for the target, so I created a measure that calculates this. It works fine if I just put it in its own card, but it creates a strange, lower than expected amount if I put it in the target field. Any ideas?

 

Thanks!

1 ACCEPTED SOLUTION

hi, @Anonymous 

You could try this formula as below:

Measure 2 = 
VAR __LAST_DATE =
    ENDOFYEAR ( 'Date'[Date] )
VAR __DATE_PERIOD =
    DATESBETWEEN (
        'Date'[Date],
        STARTOFYEAR ( DATEADD ( __LAST_DATE, -6, YEAR ) ),
        ENDOFYEAR ( DATEADD ( __LAST_DATE, -1, YEAR ) )
    )
RETURN
    AVERAGEX (
        CALCULATETABLE (
            SUMMARIZE ( VALUES ( 'Date' ), 'Date'[Date].[Year] ),
            __DATE_PERIOD
        ),
        [Cost YTD]
    )

Result:

1.JPG

And here is pbix file, please try it.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You may refer to these two same posts I have solved:

https://community.powerbi.com/t5/Desktop/KPI-card-displays-different-value-to-card-and-table-any-way-to/m-p/607882#M289548

https://community.powerbi.com/t5/Desktop/visual-KPI-week-previous-week/m-p/644979#M309098

 

Please use ALL/ALLEXCEPT/ALLSELECTED function to change the row context of average measure as above. 

 

 

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

I'm still not able to get this. I have a measure that calculate the YTD costs. If I combine this measure with the fiscal year, I get the following:

 

FiscalYear      Cost YTD
2014              $3,447,444
2015              $3,017,536
2016              $3,110,887
2017              $1,782,432
2018              $8,665,692
2019              $8,493,915

I'm trying to create a KPI visual that compares the 2019 Cost YTD ($8,493,915) to the average of the previous five years (2014-2018, $4,004,798). I can create a graph that correctly displays Cost YTD vs FiscalYear and I can create a table visual that outputs the above rows, but I can't figure out how to create a measure that gives the result of $4,004,798 that I can then use as the target value in the KPI visual.

 

Thanks again!

hi, @Anonymous 

You could try this formula as below:

Measure 2 = 
VAR __LAST_DATE =
    ENDOFYEAR ( 'Date'[Date] )
VAR __DATE_PERIOD =
    DATESBETWEEN (
        'Date'[Date],
        STARTOFYEAR ( DATEADD ( __LAST_DATE, -6, YEAR ) ),
        ENDOFYEAR ( DATEADD ( __LAST_DATE, -1, YEAR ) )
    )
RETURN
    AVERAGEX (
        CALCULATETABLE (
            SUMMARIZE ( VALUES ( 'Date' ), 'Date'[Date].[Year] ),
            __DATE_PERIOD
        ),
        [Cost YTD]
    )

Result:

1.JPG

And here is pbix file, please try it.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors