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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
JonasBI
Helper I
Helper I

Wrong output with specific filter

Hi everyone,

 

I'm rather new to Power BI and I just came across a weird error.

When I filter a Card visual that sums up a number of times an event has happened, it always shows the correct value expect for when I date slice August and a specific name. Every ouput is correct no matter what I filter for, only for this specific month in combination with a specific name, the output shows 8 when it should say 9 (i checked in the dataset and the event happend 9 times in that month with that name)

 

Thanks a lot!

1 ACCEPTED SOLUTION

@JonasBI I'm really confused. If you don't want to count those blank rows then you can do absolutely nothing. If you want to count those blank rows, then:

 

CALCULATE(COUNTA(Addresses[Date of Appointment]), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date])) + CALCULATE(COUNTBLANK(Addresses[Date of Appointment]), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

or:

CALCULATE(COUNTROWS(Addresses), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

7 REPLIES 7
Greg_Deckler
Super User
Super User

@JonasBI What is your measure formula or are you using a simple count aggregation or ?


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

CALCULATE(COUNTA(Addresses[Date of Appointment]), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

@JonasBI Any chance the Date of Appointment in Addresses for one row happens to be blank? COUNTA doesn't count blanks and that row might also get filtered via the relationship.


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

Unfortunately I can not look into the dataset at the moment. But If that was the case, can I rewrite the measure in any way so it ignores blank rows?

 

I've tried this and it doesn't solve the issue:

 

CALCULATE(count(Addresses[Date of Appointment]), NOT(ISBLANK(Addresses[Date of Appointment])), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

@JonasBI Well, the measure is already ignoring blank rows. COUNTA doesn't count blanks. 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

I just checked and the Date of Appointments in Addresses has some empty rows. Any ideas on what to try now?

@JonasBI I'm really confused. If you don't want to count those blank rows then you can do absolutely nothing. If you want to count those blank rows, then:

 

CALCULATE(COUNTA(Addresses[Date of Appointment]), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date])) + CALCULATE(COUNTBLANK(Addresses[Date of Appointment]), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

or:

CALCULATE(COUNTROWS(Addresses), USERELATIONSHIP(Addresses[Date of Appointment], 'Date'[Date]))

 


@ 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!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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