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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
berry195
Frequent Visitor

Calculate Unique days in Month (for DateTime Column)

Hello, I have a DateTime Column like this: 

berry195_0-1724655475154.png

I also have a column Month Name:

berry195_1-1724655506028.png

 

I want to create a measure to calculate how many unique days per each month. Nonetheless when I write these formulas, they do not work (always shows 31):

berry195_2-1724655736494.png

and:

berry195_3-1724655807832.png

This one works:

berry195_4-1724655914771.png

 

Could you help explain why my first 2 formulas do not work as expected, I am understanding something wrong.

Thank you a lot!



1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @berry195 - Both the first two formulas are not considering the month context when calculating distinct days. They’re working over the entire dataset rather than per month, which is why they return the total number of distinct days (or all days) in the dataset rather than for a specific month.

 

DistinctDaysPerMonth =
CALCULATE(
    DISTINCTCOUNT('Calendar1'[Date]),
    ALLEXCEPT('Calendar1', 'Calendar1'[Month Name])
)

 

rajendraongole1_0-1724656747516.png

 

 

Hope it helps.





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

Proud to be a Super User!





View solution in original post

1 REPLY 1
rajendraongole1
Super User
Super User

Hi @berry195 - Both the first two formulas are not considering the month context when calculating distinct days. They’re working over the entire dataset rather than per month, which is why they return the total number of distinct days (or all days) in the dataset rather than for a specific month.

 

DistinctDaysPerMonth =
CALCULATE(
    DISTINCTCOUNT('Calendar1'[Date]),
    ALLEXCEPT('Calendar1', 'Calendar1'[Month Name])
)

 

rajendraongole1_0-1724656747516.png

 

 

Hope it helps.





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

Proud to be a Super User!





Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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