Forum Discussion

godtooro's avatar
godtooro
Helper II
2 years ago
Solved

Percentage price variation between two dates

Dear all!

I want to calculate percetage price variation between two dates.

Is possible to make a box to introduce Start Date and End Date?

I add the pbix Fuel stimation 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi godtooro ,

     

    You can create a measure as follows.

     

    Variance = var _value=CALCULATE(SUM('Table'[Diesel]),FILTER(ALLSELECTED('Table'),[Date]>MAX('Table'[Date])))
    return ABS(DIVIDE(SUM('Table'[Diesel])-_value,_value))

     

    If you want all rows return the result, you can create a new measure.

     

    Measure = SUMX(ALLSELECTED('Table'),[Variance])

     

    You can check more details by downloading the attachment.

     

    Best Regards,

    Stephen Tao

     

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

3 Replies

    • godtooro's avatar
      godtooro
      Helper II

      Hi parry2k 

       

      Mi idea is:
      Select Date 1
      Select Date 2
      And automatically calculate % of variance.

       

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi godtooro ,

     

    You can create a measure as follows.

     

    Variance = var _value=CALCULATE(SUM('Table'[Diesel]),FILTER(ALLSELECTED('Table'),[Date]>MAX('Table'[Date])))
    return ABS(DIVIDE(SUM('Table'[Diesel])-_value,_value))

     

    If you want all rows return the result, you can create a new measure.

     

    Measure = SUMX(ALLSELECTED('Table'),[Variance])

     

    You can check more details by downloading the attachment.

     

    Best Regards,

    Stephen Tao

     

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