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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
mrbajana
Helper III
Helper III

Products Without sales in the last n days

I have a star model with the sales table as fact and the date and products dimension, so I need to show in a table or matrix the number of days that a product has not had sales in the last n days as selected. Example The product1 within the last 5 days 3 days has not had sales and only two days it has. It has to be a dynamic mesure by date and number of days

 

mrbajana_0-1715740395207.png

 

1 ACCEPTED SOLUTION

If I assume you always want to take today as the current point in time, the easiest way to do this is to add a calculated column in the product table. Write a formula something like this

 

days since sale = value(today()-calculate(max(sales[sales date]))))

 

this should give a number. You can use that in a slicer and a report. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

Try these measures

Sales = sum(Data[sale])

Measure = countrows(filter(calculatetable(calendar,datesbetween(calendar[date],today()-4,today())),[Sales]=0))

If this does not work, then share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

If I assume you always want to take today as the current point in time, the easiest way to do this is to add a calculated column in the product table. Write a formula something like this

 

days since sale = value(today()-calculate(max(sales[sales date]))))

 

this should give a number. You can use that in a slicer and a report. 



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.