Forum Discussion
Counting rows with multiple categories per row.
- 1 year ago
Hi Dsmiith ,
Thank you for reaching out to us on the Microsoft Fabric Community Forum.
Please check below calculated column "PTI_Totalbiomassa_Flag" to represent the flag values, if the parameters are equal to "PTI" or "Totalbiomassa" the column gives 1, otherwise a blank.
1. Created sample data , please refer snap.
2. Created Calculated column with below DAX .
PTI_Totalbiomassa_Flag =VAR CurrentID = 'Table'[Vattenförekomstens id]VAR CurrentParameter = 'Table'[Parameter]VAR HasPTI =CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table', 'Table'[Vattenförekomstens id]),'Table'[Parameter] = "PTI") > 0VAR HasTotalbiomassa =CALCULATE(COUNTROWS('Table'),ALLEXCEPT('Table', 'Table'[Vattenförekomstens id]),'Table'[Parameter] = "Totalbiomassa") > 0RETURNIF(HasPTI && HasTotalbiomassa &&(CurrentParameter = "PTI" || CurrentParameter = "Totalbiomassa"),1,BLANK())3. please refer output snaps and attached PBIX file.If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
- 1 year ago
Hi, first group your data using ALLROWS
then add custom column
let
paramList = List.Transform([Allrows][Parameter], each _)
in
if List.Contains(paramList, "PTI") and List.Contains(paramList, "Totalbiomassa") then 1 else nulland then expand allrows column
Yes please!
Very much interested!
Do tell!
Hi, first group your data using ALLROWS
then add custom column
let
paramList = List.Transform([Allrows][Parameter], each _)
in
if List.Contains(paramList, "PTI") and List.Contains(paramList, "Totalbiomassa") then 1 else null
and then expand allrows column