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
Sohan
Helper III
Helper III

Add data to table (snapshot)

I currently have the following measure that counts the number of appointments. :

Rolling 6 month = CALCULATE(COUNTROWS(Afspraken), DATESINPERIOD(Afspraken[Datum afspraak], TODAY(), 6, MONTH)
)
 
I want the value that comes out of this measure to be added to a table with the date of the snapshot. For example: if on 11-07-2021 there were 100 appointments in the coming 6 months and on 12-07-2021 there were 97 appointments in the coming 6 months, I want the following table.

DateNumber of appointments
11-07-2021100
12-07-202197
 
Does anyone know how I can achieve this?
4 REPLIES 4
V-pazhen-msft
Community Support
Community Support

@Sohan 

Since you are using today, to next 6 month, you will only have 1 value in the measure.

 

Change change Today to max(Date) in the measure:

Rolling 6 month = CALCULATE(COUNTROWS('Table'), DATESINPERIOD('Table'[Date], TODAY(), 6, MONTH))

 

 

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

 

 

This measure: 

Rolling 6 month = CALCULATE(COUNT(Afspraken[Datum afspraak]),
DATESINPERIOD(Afspraken[Datum afspraak], MAX(Afspraken[Datum afspraak]), 6, MONTH))

 

Seems to give the following result, which unfortunately isn't what I'm looking for. Am I doing something wrong?

Sohan_0-1626254152904.png

 

amitchandak
Super User
Super User

@Sohan , Create a new column like this with dates

 


new column =
var _max = Table[Date]
return
calculate(countrows(filter(Table, Table[Date] <= _max && Table[Date] >= date(year(_max), month(_max)-6, day(_max)))))

 

 

or summarize with dates

 

Thanks for your responde @amitchandak!

 

I'm getting the following result with this:

 

Sohan_0-1626099404413.png

 

Any idea why this happens?

 

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.