Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I've looked at other solutions here and none seem to be doing the trick.
DateTime | Item | Value |
Dec 1 9AM | A | 1 |
Dec 1 10AM | B | 3 |
Dec 2 9AM | B | 4 |
Dec 2 11AM | B | 5 |
Dec 3 12PM | A | 4 |
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.
Solved! Go to Solution.
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.
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.
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?
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.
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
41 | |
21 | |
21 | |
14 | |
13 |
User | Count |
---|---|
43 | |
35 | |
32 | |
18 | |
18 |