Forum Discussion
DAX formula help
- Anonymous4 years ago
Hi ramhariessentia ,
For me, it is difficult to give a perfect solution based on your formula by imagination alone. I have tried my best to give an answer close to your needs, but in your actual production environment, you need to adjust it to your actual situation, and I hope the solution given this time will be useful to you.
I just adjust the DAX formula according to your demands, add a new column by below formula
Column 2 = VAR cur_indexbyapp = 'Case'[index_by_app] VAR cur_app = 'Case'[Applicant] VAR tmp = FILTER ( 'Case', 'Case'[Applicant] = cur_app && 'Case'[Inspection] = "no" ) VAR ctn = COUNTROWS ( tmp ) RETURN SWITCH ( TRUE (), ctn = 2, "yes", BLANK () )Please refer attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi ramhariessentia ,
Please try below steps:
1. I create a table to test
Case:
2. add a index column in Power Query, then add a other column that group by the "Applicant" to create a index
index_by_app =
VAR cur_app = 'Case'[Applicant]
VAR tmp =
FILTER ( 'Case', 'Case'[Applicant] = cur_app )
RETURN
RANKX ( tmp, [Index],, ASC )
3. my calculate logic is that if the index_by_app=2 and the inspection="yes", then the index_by_app=3 should be "yes".
add acolumn:
Column =
VAR cur_indexbyapp = 'Case'[index_by_app]
VAR cur_app = 'Case'[Applicant]
VAR inspect =
CALCULATE (
MAX ( 'Case'[Inspection] ),
FILTER ( 'Case', 'Case'[index_by_app] = 2 && 'Case'[Applicant] = cur_app )
)
RETURN
SWITCH (
TRUE (),
cur_indexbyapp <> 3, 'Case'[Inspection],
inspect = "yes", "yes"
)
Please refer my attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks heaps, the solution needs little bit tweaking i guess, my other formula is this
can you please twaek this code, because still using the latest formula solution is not giving required result,
- Anonymous4 years agoNot applicable
Hi ramhariessentia ,
For me, it is difficult to give a perfect solution based on your formula by imagination alone. I have tried my best to give an answer close to your needs, but in your actual production environment, you need to adjust it to your actual situation, and I hope the solution given this time will be useful to you.
I just adjust the DAX formula according to your demands, add a new column by below formula
Column 2 = VAR cur_indexbyapp = 'Case'[index_by_app] VAR cur_app = 'Case'[Applicant] VAR tmp = FILTER ( 'Case', 'Case'[Applicant] = cur_app && 'Case'[Inspection] = "no" ) VAR ctn = COUNTROWS ( tmp ) RETURN SWITCH ( TRUE (), ctn = 2, "yes", BLANK () )Please refer attached .pbix file.
Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.