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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
o59393
Post Prodigy
Post Prodigy

Dax measure not returning the correct number of rows

Hi all

 

I have 2 tables linked by a column called Merged.3

 

 

The dax measure I created is returning me the total number of rows from the tablle 'All' (9), however it should return a value of 6 since I am choosing 2 of the 3 names as seen below:

 

o59393_1-1713297389052.png

 

The desired result should be 6 because Jose and Maria both have 3 rows each from the table called 'All':

 

 

o59393_0-1713297324113.png

 

Dax:

 

 

 

Non Duplicate Merged3 = 

COUNTAX(
    SUMMARIZE(
        'All',
        'All'[Merged.3]),
        'All'[Merged.3]
)

 

 

 

I attach pbix: sample_merge_3.pbix

 

Can you please help me correct the dax to have the value of 6 when I choose Jose and Maria?

 

Thanks.

1 ACCEPTED SOLUTION

@o59393 Switch relationship direction to Both. Switch your relationship columns to Name (for both tables). Switch your relationship type fo Many-to-Many. Use a measure that just does COUNTROWS('All'). See PBIX file below signature. BTW, this model is kind of odd, probably better to create a dimension table for your names like DISTINCT('Actual'[Name]), create a 1:* between this table and your All and Actual tables and use this table in your slicer.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

@o59393 Assuming that your slicer is based off of your All table, then it should just be:

COUNTROWS('All')

 

If it is not, then make sure that you have a relationship between your slicer table and your 'All' table and it still should be just COUNTROWS('All')



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

No, the slicer needs to come from the other table.,The 'All' table is just a master table.


Can you please have a look to the pbix?

 

Thanks.

@o59393 Switch your relationship direction to Both



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Hi @Greg_Deckler 

 

Switched to both and now it shows a 3, still incorrect.

 

Thanks

Hi @Greg_Deckler 

 

I tried with both, but still couldnt make it work. Can you please advise?

 

Thanks.

@o59393 Switch relationship direction to Both. Switch your relationship columns to Name (for both tables). Switch your relationship type fo Many-to-Many. Use a measure that just does COUNTROWS('All'). See PBIX file below signature. BTW, this model is kind of odd, probably better to create a dimension table for your names like DISTINCT('Actual'[Name]), create a 1:* between this table and your All and Actual tables and use this table in your slicer.



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!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Thanks @Greg_Deckler 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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