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

I want to show all open orders from previous month in a dashboard matrix

Hello,

 

I am new to Power BI. I have a table with below columne

  • Customer
  • Date: (month-year)
  • Open Orders
  • Fulfilled Orders

I want to create a matrix in my dashboard to show the open orders for each customer for previous month

so in Feb, I want to only show open orders from Jan for that customer

CustomerMonthOpen OrdersFulfilled Orders
AJan-2003
AFeb-2035
AMar-20210
AApr-20510
BJan-2005
BFeb-2046
BMar-20810
BApr-202080

So for March I want to show below matrix

 

CustomerFeb-20
A3
B4

 

Is it possible?

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You could use time intelligence function PREVIOUSMONTH or DATEADD to get it easily.

https://docs.microsoft.com/en-us/dax/previousmonth-function-dax

https://docs.microsoft.com/en-us/dax/dateadd-function-dax

and 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

PREVIOUS MONTH Data = CALCULATE(SUM('Table'[Open Orders]),PREVIOUSMONTH('Date'[Date]))
PREVIOUS MONTH Data 2 = CALCULATE(SUM('Table'[Open Orders]),DATEADD('Date'[Date],-1,MONTH))

Result:

3.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

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

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

 prefer using datesmtd and totalmtd with date calendar. Make sure you have date calendar

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)))
last MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-1,MONTH)),
Date[Date]<date(year(today()),month(today())-1,day(today())))

last MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-1,MONTH))))
last year MTD (complete) Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(ENDOFMONTH(dateadd('Date'[Date],-12,MONTH))))
last year MTD Sales =  CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],-12,MONTH)))

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/

 

Tahreem24
Super User
Super User

@Anonymous ,

 

You can try below DAX measure to get your expected result:

Prev_Month_Open_Order = CALCULATE(sum('Table'[OpenOrder]),PREVIOUSMONTH('Table'[DateColumn]))
But, make sure that you have proper date column in Date format to get the expected result.
 
Don't forget to give thumbs up 👍 and accept this as a solution if it helped you.
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
v-lili6-msft
Community Support
Community Support

hi  @Anonymous 

You could use time intelligence function PREVIOUSMONTH or DATEADD to get it easily.

https://docs.microsoft.com/en-us/dax/previousmonth-function-dax

https://docs.microsoft.com/en-us/dax/dateadd-function-dax

and 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

PREVIOUS MONTH Data = CALCULATE(SUM('Table'[Open Orders]),PREVIOUSMONTH('Date'[Date]))
PREVIOUS MONTH Data 2 = CALCULATE(SUM('Table'[Open Orders]),DATEADD('Date'[Date],-1,MONTH))

Result:

3.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Greg_Deckler
Super User
Super User

So, generally you would use PREVIOUSMONTH for that. But, if the time intelligence functions vex you, See if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I will check it out, thanks Greg

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.