cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
vanessafvg
Super User
Super User

Best practice - checking multiple fields for a value

I have about 10 columns that i need to check to see if a value is present then assign it an indicator.  I need to check them all at and if any of them have a value then the indicactor is assigned.

 

Ways of doing this could be summing them all and if the value is > 0 then assign the indictor.

 

Just out of curiosity though what do people think is the best way to do this and would you do this in Power Query with a custom column or in DAX?  





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




2 ACCEPTED SOLUTIONS
spuder
Resolver IV
Resolver IV

Hi @vanessafvg

 

I would say it depends. Man Very Happy 

 

My first thought is the same like yours. 

 

I would use Power Query. It is my first choice for transformation.

 

A solution in DAX would be by calc column 

 

Column = IF(ISBLANK(Table1[Column1]+Table1[Column2]+Table1[Column3]);"no values")

 

But I don't think it is a better way.

View solution in original post

Do you need the 10 columns for anything else aside from assigning the indicator?  If not, you could possibly unpivot the data, add a calculated column for the indicator, then re-pivot the data with only the needed columns and something like a DISTINCTCOUNT on the indicator column.

 

I would think you'd be able to do that in the Edit Queries window, so while it technically is PowerQuery, you wouldn't have to write the code yourself.

 

Hope this helps

David

View solution in original post

2 REPLIES 2
spuder
Resolver IV
Resolver IV

Hi @vanessafvg

 

I would say it depends. Man Very Happy 

 

My first thought is the same like yours. 

 

I would use Power Query. It is my first choice for transformation.

 

A solution in DAX would be by calc column 

 

Column = IF(ISBLANK(Table1[Column1]+Table1[Column2]+Table1[Column3]);"no values")

 

But I don't think it is a better way.

Do you need the 10 columns for anything else aside from assigning the indicator?  If not, you could possibly unpivot the data, add a calculated column for the indicator, then re-pivot the data with only the needed columns and something like a DISTINCTCOUNT on the indicator column.

 

I would think you'd be able to do that in the Edit Queries window, so while it technically is PowerQuery, you wouldn't have to write the code yourself.

 

Hope this helps

David

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors