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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Counting stores where sales within date range

HI,

I have stores that sale items and I need to find last sale per store within selected (calendar) date range. Sale date is related to calendar date. I want to get one row per StoreID with latest sale date that is older then max selected calendar range, and then tto count those rows. I can't solve this, help is appriciated. Thanks 

This is what I have so far.

TEST := 
VAR MaxCalDateSelected=MAX(Calendar[DAte])
RETURN
CALCULATE( COUNTROWS( Sales, FILTER(Sales,Sales[StoreID] && Sales[TotalPaymentsRunningTotal]>0 && MAX(Sales[TotalPaymentsRunningTotal] && MAX(Sales[SaleDate]<=MaxCalDateSelected)
)

 

2 REPLIES 2
Anonymous
Not applicable

I solved this, solution is to create Summary table using SUMMARIZE, like 

SUMMARIZE(tblSales, [StoreID], CALCULATE(MAX(Saledate),Sales[TotalPaymentsRunningTotal]>0))
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

Please share your sample pbix file or some data sample and expected output.Do mask sensitive data before uploading.

 

 

Best Regards,

Lin

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.

Top Solution Authors