cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

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
Community Support
Community Support

Re: Counting stores where sales within date range

hi, @tomislav1975

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.

Re: Counting stores where sales within date range

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

SUMMARIZE(tblSales, [StoreID], CALCULATE(MAX(Saledate),Sales[TotalPaymentsRunningTotal]>0))

Helpful resources

Announcements
Coming Soon: T-Shirt Design Contest

Coming Soon: T-Shirt Design Contest

Keep your eyes open for our upcoming T-shirt design contest!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors
Top Kudoed Authors