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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Cumulative distinct count

hello everyone. 

 

On my dasbhoard I have a slicer for Fiscal Month and its still filtering my DAX and I cannot figure out why. 

 

What I am trying to calculate is the disctint count of Customer IDs where the offers is > = 1. for example I am sliced on Oct 2023 for the fiscal month. This means the distinct count should be cumulative for the current selected FY. Sice Oct 2023 falls under FY24 the data should be doing a distinct count for months July 2023 - Oct 2023 (FYs start in July). why is this not working properly?

 

Measure =

 


VAR CurrentFY = MAX('Calendar'[Fiscal Year])
VAR MinMonth = CALCULATE(MIN('Calendar'[Fiscal Month]), ALL('Calendar'), 'Calendar'[Fiscal Year] = CurrentFY)
VAR MaxMonth = SELECTEDVALUE('Calendar'[Fiscal Month])

VAR Results =
CALCULATE(
    DISTINCTCOUNT(Customer[CustomerID]),
    ALL('Calendar'[Fiscal Month]),  
    'Calendar'[Fiscal Year] = CurrentFY,
    'Calendar'[Fiscal Month] <= MaxMonth,
    FILTER(
        Customer,
        [Total Offers] >= 1
    )
)

RETURN Results
1 ACCEPTED SOLUTION
AmiraBedh
Super User
Super User

I think the issue with your measure might be related to the way the ALL function is being used, particularly in the context of your slicers.

 

Try the following : 

 

Measure =
VAR CurrentFY = MAX('Calendar'[Fiscal Year])
VAR MaxMonth = SELECTEDVALUE('Calendar'[Fiscal Month])

VAR Results =
CALCULATE(
    DISTINCTCOUNT(Customer[CustomerID]),
    ALLEXCEPT('Calendar', 'Calendar'[Fiscal Year]),
    'Calendar'[Fiscal Year] = CurrentFY,
    'Calendar'[Fiscal Month] <= MaxMonth,
    FILTER(
        Customer,
        [Total Offers] >= 1
    )
)

RETURN Results

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

View solution in original post

5 REPLIES 5
AmiraBedh
Super User
Super User

I think the issue with your measure might be related to the way the ALL function is being used, particularly in the context of your slicers.

 

Try the following : 

 

Measure =
VAR CurrentFY = MAX('Calendar'[Fiscal Year])
VAR MaxMonth = SELECTEDVALUE('Calendar'[Fiscal Month])

VAR Results =
CALCULATE(
    DISTINCTCOUNT(Customer[CustomerID]),
    ALLEXCEPT('Calendar', 'Calendar'[Fiscal Year]),
    'Calendar'[Fiscal Year] = CurrentFY,
    'Calendar'[Fiscal Month] <= MaxMonth,
    FILTER(
        Customer,
        [Total Offers] >= 1
    )
)

RETURN Results

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Anonymous
Not applicable

@AmiraBedh  thanks for the help here. I just tried that and its still not working properly 

If possible can you please share your model ?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
Anonymous
Not applicable

@AmiraBedh  unfortunately I cannot share the model at this time. If I have time i will create a example file 

Yes please 🙂


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors