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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MJruud
Frequent Visitor

DISTINCTCOUNT of Index not working correctly

Greetings,

 

I've come across a rather peculiar problem. I've performed this task countless times in the past without any issues, but now I'm facing an unexpected challenge.

Within the process of transforming data, I've included an index per row, and I'm utilizing a distinct count to determine the "number of answers." However, it doesn't count correctly (see screenshot). 

 

Does anyone have any insights into what might be occurring here? Your assistance would be greatly appreciated.

 

 

2023-10-06 12_25_03-Untitled - Power BI Desktop.png

4 REPLIES 4
rajulshah
Super User
Super User

Hello @MJruud ,

 

This is happening because you have plotted the measure in the table against each index, so the filter context is that of the index plotted. If you plot the measure without the index column on in the card, then you would get the correct answer. If you get the total against each Index then you would need to remove the filter context of the Index by below formula - 

Count = CALCULATE ( DISTINCTCOUNT ( BeslutJA [ Index ] ) , ALL ( BeslutJA [ Index ] ))

 

Please let me know if this didn't help.

 

Thank you for your response.

I did attempt the process without plotting the measure against each index (which is a technique I typically employ to verify if everything is functioning as anticipated). Here's a new screenshot for your reference. Even without plotting against the index, I'm still obtaining the same number.

MJruud_0-1696590398532.png

 

HotChilli
Super User
Super User

Any Filters / slicers affecting the visual?  More than one table involved? Blank rows?

--

How about creating a card with MAX (index) on it?

or a table visual with another key value from the table with the DISTINCTCOUNT measure? and sort it different ways to see if anything shows up?

No blank rows, and no filters. 

The key value (index) I added was directly from powerQuery ( "add index"), which gives a unique value to each row (1-19181). T

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.