Forum Discussion

Berrcikk's avatar
Berrcikk
Frequent Visitor
2 years ago
Solved

KPI Visual - target value

Hi,

I’m having a problem with creating a simple report with one chart and one target visual. Let’s assume that in my model, I have fact table with total sales,product column and dim calendar. What I would like to achieve, is to calculate target on KPI visual card, as a a value of total sales for previous period on visual. So if on chart there are years, KPI card should display value for newest year, and target as total for previous year. Same, if I’m presenting quarters, then It should calculate value for current quarter, and target value as value for previous quarter. Also, it would be great to have an exception, that if there is no value for previous period, then target is not calculated. As for now, I’ve hard coded it for months, but I believe there is easier solution that I’m not aware of.

  • Hi Berrcikk 
    You can use isinscope function to manipulate with the date hierarchies and calculate your goal according to the selections.
    Please refer to the attached video :
    https://www.youtube.com/watch?v=_p9E8fiDRDw

    If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly

  • Hi Berrcikk 
    INSCOPE / Isfiltered will work, as the "goal" of the card filtered by bars on the graph.

  • Hi Berrcikk 
    You need to apply the needed logic for goals based on the hierarchy filter, if i understood you correctly, on year it should be a year ago, quarter, quarter ago, etc . 
    So it something like :
    test isincscope =
    VAR date1 =
        MAX ( DimCalendar[Date] )
    VAR vMonth =
        CALCULATE (
            SUM ( vFactSales[Total Sales] ),
             datedadd( vFactSales[Date] ,-1,month)
        )
    VAR vQuarter =
        CALCULATE (
            SUM ( vFactSales[Total Sales] ),
            datedadd( vFactSales[Date] ,-1,quarter)
        )
    VAR vYear =
        CALCULATE (
            SUM ( vFactSales[Total Sales] ),
            datedadd ( vFactSales[Date] ,-1,Year)
        )
    VAR scope1 =
        SWITCH (
            TRUE (),
            ISINSCOPE ( DimCalendar[Date].[Month] )vMonth,
            ISINSCOPE ( DimCalendar[Date].[Month] )vQuarter,
            ISINSCOPE ( DimCalendar[Date].[Month] )vYear,
            1
        )
    RETURN
        scope1

7 Replies