Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Difference day over day - column chart

Dear All,   I have a table with number of tickets per day and I would like to create a column chart that presents the difference from the precious day. For example, if on 22.01.2025 there are 15 ti...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi, Anonymous 

    Thanks for Idrissshatila's reply. You can try his reply, or you can try the following dax.

    Table 2 = 
    DISTINCT(
        SELECTCOLUMNS(
            'Table',
            "Report Date",'Table'[Report date],
            "Counts",'Table'[Column]
        )
    )
    
    Index = 
    RANKX(ALL('Table'),VALUE(FORMAT([Report Date], "YYYYMMDD")),,ASC,Dense)
    
    Diff = 
    VAR _PreviousCounts = 
        CALCULATE(
            MAX('Table 2'[Counts]),
            ALL('Table 2'),
            'Table 2'[Index] = EARLIER('Table 2'[Index]) -1
        )
    RETURN
        IF(_PreviousCounts<>BLANK(),'Table 2'[Counts] - _PreviousCounts)

     

    Best Regards,
    Yang

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    If I misunderstand your needs or you still have problems on it, please feel free to let us know.
    Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum