Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreThe FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now
I would want to find the difference in the GenHours for each serialid. Currently this is how my table looks on power BI. I have filtered the latest and 2nd latest date for each serialid.
Now i would want to find the difference between the GenHours that is being diplayed on Power BI after applying filters like removing blanks.
Can someone please help.
@amitchandak @Greg_Deckler @parry2k
Solved! Go to Solution.
Hi @axk180022
According to your statement, I know you want to show absolute Gen Difference. And you will filter your table to show first 2 date for each serialid, you just want show difference in 1st latest date and difference in 2nd latest date will show blank. Here I suggest you build a table visual and create a measure to achieve your goal. Measure could be dynamic.
My Sample:
Rank is a calculated column.
Rank = RANKX(FILTER('Table','Table'[serialid]=EARLIER('Table'[serialid])),'Table'[Dates],,DESC,Dense)
Build a table visual and filter visual by rank column to show items when value is less than or equal to 2.
Measure:
Gen Difference =
VAR _RANK1GenHours =
CALCULATE (
SUM ( 'Table'[GenHours] ),
FILTER (
ALL ( 'Table' ),
'Table'[serialid] = MAX ( 'Table'[serialid] )
&& 'Table'[Rank] = 1
)
)
VAR _RANK2GenHours =
CALCULATE (
SUM ( 'Table'[GenHours] ),
FILTER (
ALL ( 'Table' ),
'Table'[serialid] = MAX ( 'Table'[serialid] )
&& 'Table'[Rank] = 2
)
)
RETURN
IF (
SUM ( 'Table'[Rank] ) = 1,
ABS ( _RANK1GenHours - _RANK2GenHours ),
BLANK ()
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @axk180022
According to your statement, I know you want to show absolute Gen Difference. And you will filter your table to show first 2 date for each serialid, you just want show difference in 1st latest date and difference in 2nd latest date will show blank. Here I suggest you build a table visual and create a measure to achieve your goal. Measure could be dynamic.
My Sample:
Rank is a calculated column.
Rank = RANKX(FILTER('Table','Table'[serialid]=EARLIER('Table'[serialid])),'Table'[Dates],,DESC,Dense)
Build a table visual and filter visual by rank column to show items when value is less than or equal to 2.
Measure:
Gen Difference =
VAR _RANK1GenHours =
CALCULATE (
SUM ( 'Table'[GenHours] ),
FILTER (
ALL ( 'Table' ),
'Table'[serialid] = MAX ( 'Table'[serialid] )
&& 'Table'[Rank] = 1
)
)
VAR _RANK2GenHours =
CALCULATE (
SUM ( 'Table'[GenHours] ),
FILTER (
ALL ( 'Table' ),
'Table'[serialid] = MAX ( 'Table'[serialid] )
&& 'Table'[Rank] = 2
)
)
RETURN
IF (
SUM ( 'Table'[Rank] ) = 1,
ABS ( _RANK1GenHours - _RANK2GenHours ),
BLANK ()
)
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@axk180022 See my article on Mean Time Between Failure (MTBF) which uses EARLIER: http://community.powerbi.com/t5/Community-Blog/Mean-Time-Between-Failure-MTBF-and-Power-BI/ba-p/3395....
The basic pattern is:
Column =
VAR __Current = [Value]
VAR __PreviousDate = MAXX(FILTER('Table','Table'[Date] < EARLIER('Table'[Date])),[Date])
VAR __Previous = MAXX(FILTER('Table',[Date]=__PreviousDate),[Value])
RETURN
__Current - __Previous
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 52 | |
| 38 | |
| 37 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 67 | |
| 67 | |
| 34 | |
| 32 | |
| 29 |