The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I've tried calculate, groupby, and adding multiple measures, but I'm still not getting the result I need. If both columns have a value I only want to count it as 1. What am I missing?
Example: The count result I expect is 3.
Data1, Data2
1,blank
blank,1
1,1
blank,blank
Solved! Go to Solution.
Have you tried something like this:
measure = COUNTROWS(FILTER('Table', NOT(ISBLANK('Table'[Data1])) || NOT(ISBLANK('Table'[Data2]))))
Hi,
You can create a calculated column formula first
Test = 1*and(Data[Data1]<>blank(),Data[Data2]<>blank())
Next, create a measure
Measure = sum(Data[Test])
I have assumed that Data is the name of the Table.
Hope this helps.
This looks like it could work, but is only bringing back a value of 1 in the calculated column if both columns are not blank. I need it to account for both not blank, or one or the other.
Hi,
Try this
Test = 1*not(and(Data[Data1]=blank(),Data[Data2]=blank()))
That did it! Thanks so much.
You are welcome.
Hi @mmartinko ,
If I understand your question, please try this:
CountOne col =
Switch (TRUE(),
NOT(ISBLANK(MAX(BlankTable[Column1]))),1,
NOT(ISBLANK(MAX(BlankTable[Column2]))),1
)
Let me know if you have any questions.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Proud to be a Super User!
Thanks for the response. This just gives me a total of 1 though.
Have you tried something like this:
measure = COUNTROWS(FILTER('Table', NOT(ISBLANK('Table'[Data1])) || NOT(ISBLANK('Table'[Data2]))))
This appears to have worked as well and doesn't need a calculated column. Thanks!