Forum Discussion

krishna_chitrak's avatar
krishna_chitrak
Regular Visitor
2 years ago
Solved

Difference between current value and previous value respect to date.

Hello Everyone, I am fresher in Power BI. I am facing the problem following below. It would be more than a great help if, someone help me in these problem. Appreciate your support.   2023,D...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi krishna_chitrak ,

     

    Thanks for the reply from Uzi2019 , please allow me to provide another insight:

     

    You need to create a date table and then model the one-to-many relationship. Then create a formula similar to the following to be able to correctly use the date hierarchy as the x-axis.

    M_activce =
    VAR active_ =
        CALCULATE ( SUM ( 'Table'[Active] ) )
    VAR last_month =
        CALCULATE ( SUM ( 'Table'[Active] ), DATEADD ( 'Date'[Date], -1, MONTH ) )
    RETURN
        active_ - last_month
    
    M_inactivce =
    VAR inactive_ =
        CALCULATE ( SUM ( 'Table'[Inactive] ) )
    VAR last_month =
        CALCULATE ( SUM ( 'Table'[Inactive] ), DATEADD ( 'Date'[Date], -1, MONTH ) )
    RETURN
        inactive_ - last_month
    

     

    Best Regards,
    Adamk Kong

     

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