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

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

Reply
Olivier44
New Member

Count values for a specific date

Hi everyone, 

 

I have been searching for a solution for several days now but still couldn't find an answer to my issue. I hope you guys can help?

 

In my data source I have a list of assortment checks for thousands of stores over several years. Here is a simplified example of a table called "Detailed Assortment": 

 

 Example 1.JPG

 

I am trying to find the proper DAX function that will answer the following questions:

 

1/ How many products did the Customer A have in store at the end of 2017 ? The answer here would be 2 

 

I tried to add a new column with the following DAX function: 

 

Assortment last visit 2017 = CALCULATE(COUNT('Detailed Assortment'[Visit ID]),FILTER(MAXA('Detailed Assortment','Detailed Assortment'[Date])&&'Detailed Assortment'[Date].Year]=2017

 

But I got the total number of products that were in the stores in visit 1 and 2 (Total=5) when I should get only 2

 

2/ I would like to get a table with the summary of the visits displaying the following information: 

 

Expected results.JPG

 

I hope this is clear. Thank you in advance for your time

 

 

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

You should be able to create a measure like:

 

Measure =
VAR __maxDate = MAX([Date])
VAR __table = FILTER('Table',[Date] = __maxDate && [Product in store] = TRUE())
RETURN
COUNTX(__table,[Product])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

You should be able to create a measure like:

 

Measure =
VAR __maxDate = MAX([Date])
VAR __table = FILTER('Table',[Date] = __maxDate && [Product in store] = TRUE())
RETURN
COUNTX(__table,[Product])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler thank you very much it seems to work!

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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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