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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
PBIuser_2024
New Member

Distinct count

Hi Everyone,

 

I am trying to find the distinct count of products for the months of Jan - May 24, but if the product appeared in Jan this should not be counted in Feb, Mar, Apr, May. 

After the first occurance it should not be counted in the time series. Is this possible in Power BI?

 

Thanks v much in advance. 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @PBIuser_2024  you can create a measure with first month occurrance as below:

FirstMonthOccurrence =
CALCULATE(
MIN('DateTable'[MonthYear]),
ALLEXCEPT('Sales', 'Sales'[Product])
)

 

to get the distinct product by month which is not repeated in existing month, create one more new measure

DistinctProductsByMonth =
VAR SelectedMonthYear = MAX('DateTable'[MonthYear])
RETURN
CALCULATE(
DISTINCTCOUNT('Sales'[Product]),
FILTER(
'Sales',
[FirstMonthOccurrence] = SelectedMonthYear
)
)

 

drag the above measure and check each product is counted only in its first occurrence month and not in subsequent months.

 

 

Regards,

Rajendra

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.





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

Proud to be a Super User!





View solution in original post

2 REPLIES 2
PBIuser_2024
New Member

thanks @rajendraongole1 

 

I get a "Visual has exceeded the available resources" error message using the measure.

rajendraongole1
Super User
Super User

Hi @PBIuser_2024  you can create a measure with first month occurrance as below:

FirstMonthOccurrence =
CALCULATE(
MIN('DateTable'[MonthYear]),
ALLEXCEPT('Sales', 'Sales'[Product])
)

 

to get the distinct product by month which is not repeated in existing month, create one more new measure

DistinctProductsByMonth =
VAR SelectedMonthYear = MAX('DateTable'[MonthYear])
RETURN
CALCULATE(
DISTINCTCOUNT('Sales'[Product]),
FILTER(
'Sales',
[FirstMonthOccurrence] = SelectedMonthYear
)
)

 

drag the above measure and check each product is counted only in its first occurrence month and not in subsequent months.

 

 

Regards,

Rajendra

If this post helps, then please consider Accepting it as the solution to help the other members find it more quickly.





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

Proud to be a Super User!





Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.