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
Anonymous
Not applicable

Total Orders for the Last 6 Months

Hello Everyone!!

I am trying to obtain the total Orders for each of our Clients ID but just for the last 6 months. I need this to be a calculed collumn grouping by Client_ID

I have 3 importants tables in this dash:

Table ORDERS, that contains ID column, Client_ID column and Created_at (as a date) column that gives me the date of the order

Table CLIENTS that contains ID column and is linked to the Client_ID column in Table Order

Table CALENDAR that is linked to the Created_at Column

 

Thank you very much in advance!!!

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Create a measure like this

Rolling 6 = CALCULATE(count(ORDERS[ID]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

View solution in original post

6 REPLIES 6
Ashish_Mathur
Super User
Super User

Hi,

Try this

  1. Create 2 slicers and drag Year and Month to those from the Calendar Table.  Select any one month and Year
  2. To your Table/Matrix visual, drag Client_ID from the Clients Table
  3. Write this measure

=CALCULATE(count(ORDERS[ID]),datesbetween(Calendar[Date],edate(min(calendar[date]),-5),max(calendar[date])))

Hope this helps.


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

Hey @Ashish_Mathur 

I understand that with this I can filter the number of orders when I put the calendar[date] as a filter in my dash.

But actually I would like to get this result in a calculed column (and the result will change everyday, if someone makes a new order or if this client_id stops making any orders for 6 months he will get 0 orders) and with this calculed column I will create another calculed column clustering all os those clientes according to this parameter - number of orders for the last 6 months

So everyday the clients can change their cluster according to this number

Does it make sense?

Hi,

I am not clear.  Share a simple dataset and show your expected result.


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

@Anonymous , Create a measure like this

Rolling 6 = CALCULATE(count(ORDERS[ID]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH))

Anonymous
Not applicable

@amitchandak I tried here and it worked!! I only changed the -6 Month to -60 Day, it seemed better and the result was right!

Thank you very much

Anonymous
Not applicable

Hey @amitchandak 

Thank for you reply, can I substitute that MAX(Date[date]) for TODAY()? because I want to get the result in a calculed column, so with that I can analyse groups of clients_ID that has (for example) less than 5 orders for the last 6 months and give then some sort of a cluster 

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.