Forum Discussion
How to Countif Multiple Columns in PBI?
- 4 years ago
Hi pbihelpplz
I assume no relationship betweem the two tables= VAR CurrentName = SELECTEDVALUE ( Table2[name] ) RETURN COUNTROWS ( FILTER ( Table1, TableName[field 1] = CurrentName || TableName[field 2] = CurrentName || TableName[field 3] = CurrentName ) )
pbihelpplz best you unpivot the columns field 1, field 2, field 3 in Power Query before loading to the model. Then it will be straighforward.
Here is a link to download a sample solution file:
How to Countif Multiple Columns in PBI 2022-08-08.pbix
Thank you SpartaBI.
I have other fields as values, and I tried the unpivot method but the value fields become duplicated or even triplicated. I am sure there is a way to fix this but I don't know how:) still, thanks a lot for your input!
- SpartaBI4 years ago
Community Champion
pbihelpplz my pleasure, hope I could help the next time 🙂
P.S. Check out my showcase report - got some high level stuff there. Sure you will find there a lot of cool ideas. Please give it a thumbs up over there if you liked it 🙂
https://community.powerbi.com/t5/Data-Stories-Gallery/SpartaBI-Feat-Contoso-100K/td-p/2449543