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 need help in two DAX formulas that would bring a previous row value for a certain column based on a filter criteria.
The formula would be for PrevFinish = ................................... It would consider and Repeat the Finish_Downtime for the first Index column [ID], obeying the criteria that it belongs to the same MACHINE_ID.
It could also be solved if we have a formula for the Rows_Above = .................... What is the ID difference between the current row ID and the first Row above that also belongs to the same Machine_ID
|
Solved! Go to Solution.
Hi, @Anonymous
Please check the below for creating new measures.
Prev Finish Measure =
VAR rankbyfinishtime =
RANKX (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
CALCULATE ( MAX ( 'Table'[Finish_Dowtime] ) ),
,
DESC
)
VAR prevtime =
CALCULATE (
MAX ( 'Table'[Finish_Dowtime] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
RANKX (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
CALCULATE ( MAX ( 'Table'[Finish_Dowtime] ) ),
,
DESC
) > rankbyfinishtime
)
)
RETURN
IF ( ISFILTERED ( 'Table'[ID] ), prevtime )
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
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.
The solution works Jihwan, but they come as a Measure - what should I change in those same DAX formulas for them to work as a new column and not a Measure?
regards,
Leonardo
Hi, @Anonymous
Please check the below.
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.
Hi, @Anonymous
Please check the below for creating new measures.
Prev Finish Measure =
VAR rankbyfinishtime =
RANKX (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
CALCULATE ( MAX ( 'Table'[Finish_Dowtime] ) ),
,
DESC
)
VAR prevtime =
CALCULATE (
MAX ( 'Table'[Finish_Dowtime] ),
FILTER (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
RANKX (
ALLEXCEPT ( 'Table', 'Table'[MACHINE_ID] ),
CALCULATE ( MAX ( 'Table'[Finish_Dowtime] ) ),
,
DESC
) > rankbyfinishtime
)
)
RETURN
IF ( ISFILTERED ( 'Table'[ID] ), prevtime )
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
Linkedin: linkedin.com/in/jihwankim1975/
Twitter: twitter.com/Jihwan_JHKIM
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.
The solution works Jihwan, but they come as a Measure - what should I change in those same DAX formulas for them to work as a new column and not a Measure?
regards,
Leonardo
Hi, @Anonymous
Please check the below.
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.
Jihwan,
It worked well, most of my parameters are in Columns and formulas with Measures and Columns can always be trick.
Have a good week,
Leonardo
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 |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |