Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Show the Daily Difference for Each Item

I've looked at other solutions here and none seem to be doing the trick. 

DateTimeItemValue
Dec 1 9AMA1
Dec 1 10AMB3
Dec 2 9AMB4
Dec 2 11AMB5
Dec 3 12PMA4

 

So there's a few things going on here, but essentially, I need to show a graph that shows how much each Item has increased for each day. 

In this case, a clustered graph would show:
- Dec 1: 0 for Items A and B (as there's no previous date to report an increase from)
- Dec 2: 0 for A (as there are no entries for Item A for Dec 2) and 2 for Item B ( ([Dec 1 for B] = 3) minus ([last entry for Dec 2] = 5) = 2).
- Dec 3: 3 for A, and 0 for B using the same logic. 

Let me know if you need any more details, but this seems extremely difficult given the research and solutions I've already tried.

 

Thank you VERY much!

Edit: This was poorly worded, so I tried to clean it up.

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

I tried to create date only column and time only column in order to show a visualization like below.

 

Jihwan_Kim_0-1674477802956.png

 

Expected result measure: =
VAR _currentlastvalue =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Time] = MAX ( 'Table'[Time] ) )
VAR _prevlasttime =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Item] = MAX ( 'Table'[Item] )
                && 'Table'[Date] < MAX ( 'Table'[Date] )
        ),
        'Table'[Time]
    )
VAR _prevlastvalue =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Item] = MAX ( 'Table'[Item] )
                && 'Table'[Date] < MAX ( 'Table'[Date] )
                && 'Table'[Time] = _prevlasttime
        )
    )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Date] ) && ISINSCOPE ( 'Table'[Item] ),
        SWITCH (
            TRUE (),
            _prevlastvalue <> BLANK (), _currentlastvalue - _prevlastvalue,
            _prevlastvalue = BLANK (), 0
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Wow! This works! Thank you for this!

There is one extra problem. I've got thousands of entries between December 22 and January 22 (31 days). So my graph is cramped and tiny. How can I make it so that it shows the results for the day, as well as the hour?

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your datamodel looks like, but please check the below picture and the attached pbix file.

I tried to create date only column and time only column in order to show a visualization like below.

 

Jihwan_Kim_0-1674477802956.png

 

Expected result measure: =
VAR _currentlastvalue =
    CALCULATE ( SUM ( 'Table'[Value] ), 'Table'[Time] = MAX ( 'Table'[Time] ) )
VAR _prevlasttime =
    MAXX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[Item] = MAX ( 'Table'[Item] )
                && 'Table'[Date] < MAX ( 'Table'[Date] )
        ),
        'Table'[Time]
    )
VAR _prevlastvalue =
    CALCULATE (
        SUM ( 'Table'[Value] ),
        FILTER (
            ALL ( 'Table' ),
            'Table'[Item] = MAX ( 'Table'[Item] )
                && 'Table'[Date] < MAX ( 'Table'[Date] )
                && 'Table'[Time] = _prevlasttime
        )
    )
RETURN
    IF (
        ISINSCOPE ( 'Table'[Date] ) && ISINSCOPE ( 'Table'[Item] ),
        SWITCH (
            TRUE (),
            _prevlastvalue <> BLANK (), _currentlastvalue - _prevlastvalue,
            _prevlastvalue = BLANK (), 0
        )
    )

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.