cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vitor_sp_bo
Helper I
Helper I

Recurrence Product

Guys, all right?

I have a dataset with 2 columns (Product Code, Date), I need to map the products that are recurring for example (today() and today()-1), the big problem is that I have 1 date per line as in the example below

 

Codigo produtoData
00101/02/2021
00102/02/2021
00103/02/2021
00104/02/2021
00105/02/2021
00106/02/2021
00107/02/2021
00201/02/2021
00202/02/2021
00203/02/2021
00204/02/2021
00205/02/2021
00206/02/2021
00207/02/2021
00208/02/2021
1 ACCEPTED SOLUTION
speedramps
Solution Sage
Solution Sage

Please consider this solution and click the thumbs up icon just for me taking the effort to helping you, and click accept the solutioin if it fixes your problem. Cheers !

 

Reoccurs =
var mydate = SELECTEDVALUE('Table'[Date])
var prevdate = mydate - 1
RETURN
CALCULATE(
COUNTROWS('Table'),
'Table'[Date] = prevdate
)
 

View solution in original post

5 REPLIES 5
speedramps
Solution Sage
Solution Sage

Please consider this solution and click the thumbs up icon just for me taking the effort to helping you, and click accept the solutioin if it fixes your problem. Cheers !

 

Reoccurs =
var mydate = SELECTEDVALUE('Table'[Date])
var prevdate = mydate - 1
RETURN
CALCULATE(
COUNTROWS('Table'),
'Table'[Date] = prevdate
)
 

View solution in original post

It didn't work, I need to count the products that were yesterday and today, so I need the two values ​​to define the recurrence

If you create a visual table with product and date then this measure will flag any product that has a record for the previous day.   I tested it ok
Capture.JPG 

Reoccurs =
var mydate = SELECTEDVALUE('Table'[Date])
var prevdate = mydate - 1
RETURN
CALCULATE(
COUNTROWS('Table'),
'Table'[Date] = prevdate
)
 

Okay, I need it to filter by product code, that way it would only evaluate the date, right?

Hi again Vitor_sp_bo

 

Report visuals have default row and column filters. In this case Product and Date.

 

The CALCULATE command is amazing and lets you override one or more of these default row filters.

 

In my example the CALCULATE command does not override the default row Product filter, but it does override the default row Date filter with the previous date. So this will only get the previous date for the same Product, because the default row Product filter is still applied. Understand now?

 

You can sort the visual by Product and Date and the measure will still work ok, because the measure uses the source data and not the sequence of report rows.

 

You can add a Product slicer but take care adding a Date slicer.

 

Please click the thumbs up and ACCEPT SOLUTION.  Thank you

 

Reoccurs =

var mydate = SELECTEDVALUE('Table'[Date])

var prevdate = mydate - 1

RETURN

CALCULATE(

COUNTROWS('Table'),

'Table'[Date] = prevdate

)

 

Capture.JPG

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

November Power BI Update 768x460.png

Check it Out!

Click here to read more about the November 2021 Updates!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.