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
abodqm
Regular Visitor

i want to count distinct count in some way is it possible

i have lets say 5 centers in monthly basis with data about clients and some of them doesnt appear in some months i want to count them and put them in a table to know which centers of those doesnt have any data in that month and ofcourse i have to count them as distinct can i do this ? im a beginner in dax and power bi 

 

Ex. centers
alquds center
alsuwaidi center
alarid center
alhilal center
alrabwah center

 

1 ACCEPTED SOLUTION

Hi @abodqm ,

Suppose we have:

vcgaomsft_1-1703584262699.png
Please try like:

Measure = 
VAR _cur_month_number = SELECTEDVALUE('Table'[Month])
VAR _centers_before = CALCULATETABLE(VALUES('Table'[centers]),'Table'[Month]<_cur_month_number)
VAR _result = IF(ISBLANK(_cur_month_number),"Please choose a month",CALCULATE(DISTINCTCOUNT('Table'[centers]),NOT 'Table'[centers] IN _centers_before))
RETURN
_result

Output:

vcgaomsft_0-1703584237171.png

check the pbix file.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

View solution in original post

5 REPLIES 5
ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




abodqm_0-1703052192556.png

 

look here 5 centers in feb second photo there is one center how do i know the rest that doesn't have any data in a list can i do somthing to make them in every month show me the one's with no data 

abodqm_1-1703052192557.png

 

 

@abodqm 

pls try 

DISTINCTCOUNT(centers)

DISTINCTCOUNT function (DAX) - DAX | Microsoft Learn





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




bro i am using distinct count 

Hi @abodqm ,

Suppose we have:

vcgaomsft_1-1703584262699.png
Please try like:

Measure = 
VAR _cur_month_number = SELECTEDVALUE('Table'[Month])
VAR _centers_before = CALCULATETABLE(VALUES('Table'[centers]),'Table'[Month]<_cur_month_number)
VAR _result = IF(ISBLANK(_cur_month_number),"Please choose a month",CALCULATE(DISTINCTCOUNT('Table'[centers]),NOT 'Table'[centers] IN _centers_before))
RETURN
_result

Output:

vcgaomsft_0-1703584237171.png

check the pbix file.

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

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.