Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Calculate quantity orders last 12 months

Hi all,

I want to calculate the quantity orders (column order_ref) over the rolling last 12 months (column order_dat).

If the quantity orders is > 0 , the outcome of the formula must be 1.

If the outcome of the formula = 0, the outcome of the formula must be 0.

Thanks fo your help!

John

 

help.JPG

 

3 ACCEPTED SOLUTIONS
nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Could you copy-paste your table here? If possible please share the expected output as well.

 


Regards,
Nandu Krishna

View solution in original post

amitchandak
Super User
Super User

You can use something like this date calendar.

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-12,MONTH))

 

Or use the relative date filter https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

She @amitchandak the @nandukrishnavs ,

Problem solved!

Thank you!

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

You can use something like this date calendar.

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date Filer],MAX(Sales[Sales Date]),-12,MONTH))

 

Or use the relative date filter https://docs.microsoft.com/en-us/power-bi/visuals/desktop-slicer-filter-date-range

 

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions
https://www.archerpoint.com/blog/Posts/creating-date-table-power-bi
https://www.sqlbi.com/articles/creating-a-simple-date-table-in-dax/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

She @amitchandak the @nandukrishnavs ,

Problem solved!

Thank you!

@jwi1

You have marked my comment as an Accepted Solution. Please mark amitchandak's solution as an Accepted Solution.


Regards,
Nandu Krishna

nandukrishnavs
Community Champion
Community Champion

@Anonymous 

 

Could you copy-paste your table here? If possible please share the expected output as well.

 


Regards,
Nandu Krishna

Anonymous
Not applicable

@nandukrishnavs,

 

As the quantity orders over the last rolling 12 months = 14, the output must be "1"

 

partnumber_sup order_ref order_dat order_status_desc order_amount order_amount_total

3328053479315-4-2020Received1010
332805347847-4-2020Received3030
3328053474810-3-2020Received1010
3328053468230-1-2020Received1010
3328053459511-12-2019Received1010
3328053453818-11-2019Received1010
332805345041-11-2019Received1010
3328053448022-10-2019Received1010
3328053446316-10-2019Received1010
332805344362-10-2019Received1010
3328053439512-9-2019Received2020
332805343773-9-2019Received1010
3328053435020-8-2019Received1010
332805341821-5-2019Received1010
332805341371-4-2019Received1010
3328053409911-3-2019Received1010
332805340951-3-2019Received1010
3328053406111-2-2019Received1010
3328053403825-1-2019Received1010
3328053401916-1-2019Received1010
332805340014-1-2019Received1010

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.