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.
Hello,
I want to calculate the Distinct Count for Rolling 6 months for the ORDER_NO
For example: If I'm looking at the current month, the Rolling 6Month Count should reflect the total count for the prior 6 months (not including the current month)
Here is what I tried but it does not give me the correct numbers.
Any help on this much appreciated! Thank you.
Solved! Go to Solution.
@Anonymous
How about:
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date], MAX('Calendar [Date]), -6,MONTH )) - DISTINCTCOUNT(Table[ORDER NO])
This should exclude the current month value.
EDIT: Actually, depending on whether you wish to exclude the rolling last month, you might need:
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date], MAX('Calendar [Date]), -7,MONTH )) - CALCULATE(DISTINCTCOUNT(Table[ORDER NO]), DATESINPERIOD(Calendar'[Date], MAX('Calendar [Date]), -1,MONTH ))
Proud to be a Super User!
Paul on Linkedin.
@Anonymous
How about:
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date], MAX('Calendar [Date]), -6,MONTH )) - DISTINCTCOUNT(Table[ORDER NO])
This should exclude the current month value.
EDIT: Actually, depending on whether you wish to exclude the rolling last month, you might need:
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date], MAX('Calendar [Date]), -7,MONTH )) - CALCULATE(DISTINCTCOUNT(Table[ORDER NO]), DATESINPERIOD(Calendar'[Date], MAX('Calendar [Date]), -1,MONTH ))
Proud to be a Super User!
Paul on Linkedin.
Thank you, Looks like this works!
@Anonymous
Great! Out of curiosity, which one are you using?
Proud to be a Super User!
Paul on Linkedin.
I'm using this
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date], MAX('Calendar [Date]), -6,MONTH )) - DISTINCTCOUNT(Table[ORDER NO])
@Anonymous , try like
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date],eomonth( MAX(Table[TA1]),-1), -6,MONTH ))
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date],ENDOFMONTH( MAX(Table[TA1]),-1,month), -6,MONTH ))
Hi @amitchandak Thank you, but it didn't give me the results I'm looking for.
I used the following
Rolling 6M Count = CALCULATE(DISTINCTCOUNT(Table[ORDER_NO]),
DATESINPERIOD('Calendar'[Date],eomonth( MAX(Table[TA1]),-1), -6,MONTH ))
The results I'm getting starts from Feb 19, My data starts from Jan 19 to current Date.
The Rolling 6 Month count should start to show from the 6th month correct?
For example, If I'm looking at July 19, It should show the total count of Orders from Jan 19 -Jun 19.
Jan 19 -Jun 19 Should not have any results since there are no data for the previous 6 months data available.
Thank you!
I have a different Measure which counts the order numbers for Rolling months. which works great. Is there a way to use that Measure to calculate this 6 Month rolling?
HI @Anonymous
CALCULATE(DISTINCTCOUNT(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-6,MONTH)))
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
HI @Anonymous
I tested it out, you could refer to below steps:
Create a calender table:
Table = CALENDARAUTO()
Create a measure:
DIVIDE(CALCULATE(DISTINCTCOUNT(Sales[Sales Amount]),DATESINPERIOD('Table'[Date],MAX('Sales'[Date]),-6,MONTH)),6)
Hope it resolves your issue? Did I answer your question? Mark my post as a solution! Appreciate your Kudos, Press the thumbs up button!! Linkedin Profile |
Thank you @pranit828 it did not work, it gave me the count for the 6th month ago Order only.
For example: for July the result was 6 (Jan only count), It should be Order numbers count from Jan -Jun)
Thanks
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
97 | |
85 | |
70 | |
61 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |