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

DAX Measure - Get Prior Amount

hello all - i have a table that shows customer order information - Order Id, Customer Id, Order Date, Status, Amount. If i select a time period - month, quarter, etc. i need to show the the last period Amount. For example, if i select 2019 March, i want to show the Order Amount where the order date = March 1st 2019. Any ideas?

3 REPLIES 3
Tahreem24
Super User
Super User

Hi @Anonymous,

 

You can calculate the First day of the month using below DAX formula:

FirstdayofMonthSales = CALCULATE(sum(Data[Sales]),STARTOFMONTH(Data[Date]))
 
Please accept my answer as a solution if Its 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
Anonymous
Not applicable

Hi,

 

I assume you are wanting to do a Date Filter. There are multiple Types in this, You could use a Drop down Date Filter or a Slicer to Specify the Date Range ( Start and End Date).

1. Single Date Value

Value := 
VAR Date= SELECTEDVALUE(Order[date])
RETURN CALCULATE(SUM(Order[Order], Order[date]= Date)

2. Date Range (Slicer)

Value:= VAR First_Date= FIRSTDATE(Order[date])
VAR Last_Date=LASTDATE(Order[date])
RETURN CALCULATE(SUM(Order[Orders]), FILTER(Order, Order[Date] >= First_Date && Order[Date]<= Last_Date))

Best Regards,
Vignesh M

If what I suggested worked for you feel free to Drop a "Kudos" and Consider to "Accept as Solution" if I solved your Issue 🙂

Anonymous
Not applicable


@Anonymous wrote:

Hi,

 

I assume you are wanting to do a Date Filter. There are multiple Types in this, You could use a Drop down Date Filter or a Slicer to Specify the Date Range ( Start and End Date).

1. Single Date Value

Value := 
VAR Date= SELECTEDVALUE(Order[date])
RETURN CALCULATE(SUM(Order[Order], Order[date]= Date)

2. Date Range (Slicer)

Value:= VAR First_Date= FIRSTDATE(Order[date])
VAR Last_Date=LASTDATE(Order[date])
RETURN CALCULATE(SUM(Order[Orders]), FILTER(Order, Order[Date] >= First_Date && Order[Date]<= Last_Date))

 


I just did a test but it is returning the same value as the Amount. See below. For example, for customer 456, date 4/1/2019, the Value measure should be 50. Thoughts?

Untitled.png

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.