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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

count number of values in each column with DAX

Hello everyone,

 

I am trying to count values in each column and get the values into another table. 

meteboncukcu_1-1629474244332.png

 

this is what I want to achieve:

 

meteboncukcu_2-1629474296830.png

 

I have tried several functions, one of them is here.

Daten Prüfung = 
ADDCOLUMNS(SUMMARIZE(Uferbauwerke_validation,
    Uferbauwerke_validation[Bauteilkategorie_check],
    "bau", CALCULATE(COUNT(Uferbauwerke_validation[Bauteilkategorie_check]),FILTER(Uferbauwerke_validation, Uferbauwerke_validation[Bauteilkategorie_check]="bestehende Daten")), 
    "bau_kein", CALCULATE(COUNT(Uferbauwerke_validation[Bauteilkategorie_check]), FILTER(Uferbauwerke_validation, Uferbauwerke_validation[Bauteilkategorie_check]="keine Daten")) ,   
    "material", CALCULATE(COUNT(Uferbauwerke_validation[Material_check]), FILTER(Uferbauwerke_validation, Uferbauwerke_validation[Material_check]="bestehende Daten")),
    "material_kein", CALCULATE(COUNT(Uferbauwerke_validation[Material_check]), Uferbauwerke_validation[Material_check]="keine Daten" )),
    
    
    "total",  COUNT ( Uferbauwerke_validation[Bauteilkategorie_check] ))



But I could not achieve what I really need. Any help would be great! Many thanks in advance!

 

1 ACCEPTED SOLUTION

@Anonymous You could always UNION a SELECTCOLUMNS of each column and then DISTINCT to get a table of the distinct values in all of the columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Greg_Deckler
Community Champion
Community Champion

@Anonymous You would likely be better off unpivoting your columns. That said, you could use MC Aggregations:

Multi-Column Aggregations (MC Aggregations) - Microsoft Power BI Community



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler thanks for the reply.
This solution seems to check values in a row.
However, I need to check the number of values in each column, and adding the results into another table as a summarization.

@Anonymous Is this the only table you are working with? Do you have the values you want to count in a separate table? And again, unpivoting your columns would make this child's play. Is that not possible?



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler the table is collection of data which are existing in other source tables. I am not able to work on it in power query, that is why I couldn't apply unpivoting option. Is there any way to summarize values in each column by using DAX? 
at the end, I try to create this table:

meteboncukcu_0-1629733872047.png

 

@Anonymous You could always UNION a SELECTCOLUMNS of each column and then DISTINCT to get a table of the distinct values in all of the columns.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

@Greg_Deckler I am not sure if this is what you mentioned but it works somehow 🙂

 

meteboncukcu_0-1629983075223.png

 

 

Daten Prüfung = UNION(
distinct(SELECTCOLUMNS('Uferbauwerke_validation',
"Daten Art", "bestehende Daten",
"bau", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Bauteilkategorie_check]="bestehende Daten"),"bestehende Daten"),
"nutzung", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Nutzung_check]="bestehende Daten"),"bestehende Daten"),
"material", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Material_check]="bestehende Daten"),"bestehende Daten"),
"quartier", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Quartier_check]="bestehende Daten"),"bestehende Daten"),
"zustand", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Zustand_check]="bestehende Daten"),"bestehende Daten"),
"laufende_Nummer", COUNTAX(FILTER(Uferbauwerke_validation,Uferbauwerke_validation[laufende_Nummer_check]="bestehende Daten"),"bestehende Daten")
)),
distinct(SELECTCOLUMNS('Uferbauwerke_validation',
"Daten Art", "keine Daten",
"bau", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Bauteilkategorie_check]="keine Daten"),"keine Daten"),
"nutzung", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Nutzung_check]="keine Daten"),"keine Daten"),
"material", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Material_check]="keine Daten"),"keine Daten"),
"quartier", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Quartier_check]="keine Daten"),"keine Daten"),
"zustand", COUNTAX(FILTER('Uferbauwerke_validation','Uferbauwerke_validation'[Zustand_check]="keine Daten"),"keine Daten"),
"laufende_Nummer", COUNTAX(FILTER(Uferbauwerke_validation,Uferbauwerke_validation[laufende_Nummer_check]="keine Daten"),"keine Daten")
)))

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.