I am trying to calculate the number of records in a table that have occurred in the last 30 (60 and 90) days from a date selected on my slicer. I have tried multiple formulas without success. I have a date table also.
I would appreciate any advice. Thanks
Could you please mark the proper answer as solution or share the solution if it's convenient for you? That will be a big help to the others.
This question has more then one solution.
1) A simple way to anterstand a calculation IMHO is create 3 new calculate rows in your Fact table with 3 dates (+30, +60 and +90 days from the current date).
2) Alternate way is a bit comlex, but more flexible (see link bellow):
Days_Interval = GENERATESERIES(1;90)and rename "Values" to "Days".
Max_Days_Value = MAXX( KEEPFILTERS(VALUES('Days_Interval'[Days])); CALCULATE(MAX('Days_Interval'[Days])) )
RecordCount_LastXDays = CALCULATE ( COUNTROWS ( Dates ); DATESINPERIOD ( Dates[Dates]; FIRSTDATE( Dates[Dates] ); [Max_Days_Value];DAY) )of course instead "Dates" must be your Fact table.
This is example PBIX. Enjoy
Click here to learn more about the August 2022 updates!
Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.