Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
HenryJS
Post Prodigy
Post Prodigy

DAX: Count Multiple Column Values

Hi all,

 

I want to create a measure that counts if Reference1, Reference2 and Reference3 has a value in the field?

 

For example the top row would be 2 as Reference1 and Reference2 have a value in field.

 

References.PNG

1 ACCEPTED SOLUTION
v-kelly-msft
Community Support
Community Support

Hi @HenryJS ,

 

Does "N/A" mean a value, if so ,you need a calculated column as below:

 

Column = IF('Table'[Reference 1]=BLANK(),0,1)+IF('Table'[Reference 2]=BLANK(),0,1)+IF('Table'[Reference 3]=BLANK(),0,1)

 

Otherwise,a calculated column as below:

 

Column 2 = IF('Table'[Reference 1]=BLANK() || 'Table'[Reference 1]="N/A",0,1)+IF('Table'[Reference 2]=BLANK() || 'Table'[Reference 2]="N/A",0,1)+IF('Table'[Reference 3]=BLANK() || 'Table'[Reference 3]="N/A",0,1)

 

And you will see :

 

 

Annotation 2020-02-04 133418.png

 

For the related .pbix file,pls click here.

 

 
Best Regards,
Kelly

View solution in original post

2 REPLIES 2
v-kelly-msft
Community Support
Community Support

Hi @HenryJS ,

 

Does "N/A" mean a value, if so ,you need a calculated column as below:

 

Column = IF('Table'[Reference 1]=BLANK(),0,1)+IF('Table'[Reference 2]=BLANK(),0,1)+IF('Table'[Reference 3]=BLANK(),0,1)

 

Otherwise,a calculated column as below:

 

Column 2 = IF('Table'[Reference 1]=BLANK() || 'Table'[Reference 1]="N/A",0,1)+IF('Table'[Reference 2]=BLANK() || 'Table'[Reference 2]="N/A",0,1)+IF('Table'[Reference 3]=BLANK() || 'Table'[Reference 3]="N/A",0,1)

 

And you will see :

 

 

Annotation 2020-02-04 133418.png

 

For the related .pbix file,pls click here.

 

 
Best Regards,
Kelly

az38
Community Champion
Community Champion

Hi @HenryJS 

its better to create calculated column, not measure, like

 

Column = 
IF((ISBLANK([Reference1]), 0, 1) + 
IF((ISBLANK([Reference2]), 0, 1) + 
IF((ISBLANK([Reference3]), 0, 1)

 

do not hesitate to give a kudo to useful posts and mark solutions as solution

LinkedIn


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.