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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Count of distinct Values inside the column

Hello,

 

 

I have a scenario where i need the distinct value count in a column according to the dates selected in the slicer.

 

Example:

I have used the following DAX measure( count_2) to get the count of distinct item locations according to the dates selected in the slicer.

Ishan25_0-1595849831717.png

But as you can see in the screenshot it shows the count of item location "ZZ"  as 1.

I want it show 2 as it is appearing two times in the output.

 

Here is the date slicer applied:

Ishan25_1-1595850009014.png

 

 

Any help would be much appreciated.

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You get 1 because for ZZ the rows are different. You distinguish them with "last user update." One has SANJAY and the other one IGRAHAM. This is why you see 1.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

You get 1 because for ZZ the rows are different. You distinguish them with "last user update." One has SANJAY and the other one IGRAHAM. This is why you see 1.
mahoneypat
Microsoft Employee
Microsoft Employee

The columns you add to your table act as filters.  In your case, that includes the Date and Branch columns.  To remove specific filters, you need to use a variant of the ALL() function (or REMOVEFILTERS()).  To get 2 from your data, I think you will need the following

 

New Count = CALCULATE([count_2], ALL(Table[Branch], Table[Branch Description]), ALLSELECTED('Date'[Date])

 

Note that the Date one uses ALLSELECTED.  That will remove the filter on that column but just in the table (it will keep the filter on the Dates selected in your slicer).

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

Hello @mahoneypat 

 

This is giving me exactly the same as count_2

 

Ishan25_0-1595853021195.png

 

Anonymous
Not applicable

Hello @mahoneypat 

 

I can remove count_2 as this might not be required, i basically need a count of different item locations in the report as per the selected dates.

 

I need to get same the output similar to the filter of item Location in filter pane:

Ishan25_0-1595853299582.png

 

 

 

Hi @Anonymous ,

 

Try if this works

 

LocationsCount =
COUNTROWS (
    FILTER (
        ALL ( ItemLocation[itemlocation] ),
        ItemLocation[itemlocation]
            = MAX ( ItemLocation[itemlocation] )
    )
)

 

Regards,

Harsh Nathani

 

Anonymous
Not applicable

Hi @harshnathani 

 

This does not work:

Ishan25_0-1595854539771.png

The measure count_2 works as expected when i remove all the fields:

Ishan25_2-1595854669379.png

But as soon as i bring branch or any other field it fails to work.

I need to ingore all the other fields as filters .

 

 

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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