Forum Discussion

shamsuddeenvp's avatar
shamsuddeenvp
Post Patron
10 years ago

KPI visual in Power BI

Dear,

 

I need to have a KPI, which shows sales comparing to the previous year for all the filter selection.

 

I created a measure using SAMEPERIODLASTYEAR function, however it doesnt work properly with the existing KPI visual in ower BI Desktop.

 

Can anybidy guide on this. Req is to have a value which gives % variance compared to previous year value.

 

Br,

Shamsuddeen

7 Replies

  • Sean's avatar
    Sean
    Community Champion

    shamsuddeenvp What exactly is not working properly? The Measure or what you are seeing in the Visual?

     

    Generally without knowing any details for YoY (arrange the fields like this)

    Indicator => YTD

    Trend Axis => Year

    Target Goal => YTD Same Period Last Year Measure

     

  • Anonymous's avatar
    Anonymous
    Not applicable
    Hi,
    If your requirement is using the DAX formula u mentioned above, then
    Try joining the Date field of your fact table, with date dimension.
    Then perform the calculation. Let me know if it works.
    • shamsuddeenvp's avatar
      shamsuddeenvp
      Post Patron

      Thanks Anonymous and Sean for your inputs.

       

      I need not to have a trend, just need to have a comparison with current value with the previous year. and shows the variance value. How to implement that in Power BI dekstop with the arrows (red or green) which changes dynamically based on the variance.

       

      Below is 

      I am trying to use the the KPI visual which is there in out of the box.

       

      I have calculated a measure 

      lastPeriodValArr:=CALCULATE(
      COUNTROWS('Arrival')
      ,SAMEPERIODLASTYEAR('Date'[Date])
      ,AllExcept('Date', 'Date'[Date])
      )

       

      I have added Month_Name in trend.

       

      Value: Current duration value

       

      Target: Above measure

       

      It looks fine (we need to select some year to claculate the previous year), Actually Dashboard shows all the values  (not filters any year) at load and this KPI shows error since user not selected any year or any filter which calculates lastyearperiodvalue.

       

      Error: "SAMEPERIODLASTYEAR only works with contiguous date selection."

       

      Br,

      Shamsuddeen