Forum Discussion
Power BI DAX query
- 4 years ago
Hi powerbi_enthu ,
According to my test, I need to first extract the event group field in power query as the basis for grouping, and then sort the group. Then create the following dax formula in desktop with the following reference:
Column = RANKX ( FILTER ( ALL ( 'Table' ), 'Table'[Group] = EARLIER ( 'Table'[Group] ) ), 'Table'[event start date], , ASC, DENSE )Col_result = VAR cur_index = 'Table'[Column] + 1 RETURN IF ( 'Table'[Column] = 4, TODAY (), CALCULATE ( MAX ( 'Table'[event start date] ) - 1, FILTER ( ALL ( 'Table' ), 'Table'[Column] = cur_index && 'Table'[Group] = EARLIER ( 'Table'[Group] ) ) ) )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi powerbi_enthu ,
According to my test, I need to first extract the event group field in power query as the basis for grouping, and then sort the group. Then create the following dax formula in desktop with the following reference:
Column =
RANKX (
FILTER ( ALL ( 'Table' ), 'Table'[Group] = EARLIER ( 'Table'[Group] ) ),
'Table'[event start date],
,
ASC,
DENSE
)Col_result =
VAR cur_index = 'Table'[Column] + 1
RETURN
IF (
'Table'[Column] = 4,
TODAY (),
CALCULATE (
MAX ( 'Table'[event start date] ) - 1,
FILTER (
ALL ( 'Table' ),
'Table'[Column] = cur_index
&& 'Table'[Group] = EARLIER ( 'Table'[Group] )
)
)
)
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.