Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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!
User | Count |
---|---|
76 | |
75 | |
46 | |
31 | |
27 |
User | Count |
---|---|
99 | |
91 | |
51 | |
49 | |
46 |