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

Calculation based on latest submitted data

Here is an example of the table I have 

 

ProductsSalesReporting DateSubmitted Date
514710/19/201811/16/2018
498511/11/201812/5/2018
141112/1/20181/3/2019
1018812/5/20181/15/2019
656412/19/20181/18/2019
23841/15/20192/25/2019

 

The calculation I want is Rate = ([Products] / [Sales]) * 1000

 

But I want it only for the latest submitted data. Currently I have a date slicer set up on [Reporting Month]. An example of what I want to happen is if the date slicer is set to December 2018 then I want the calculated rate to be from the data submitted on 1/18/2019 or (6/564)*1000. 

 

I tried a calculation with LASTDATE but it seems like it is just finding the lastdate in the whole column and does not change with the slicer. 

 

For example a measure that just sums the latest available products does not move with a slicer so i think it is wrong.

 

My measure = CALCULATE(SUM('TableI'[Products]),LASTDATE('Table'[Submitted]))
 
thanks for any help
1 ACCEPTED SOLUTION
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Try this DAX...

 

Measure = 
VAR MAX_SUBMITTED_DATE = MAX('Table'[Submitted Date])
RETURN CALCULATE((SUM('Table'[Products])/SUM('Table'[Sales]))*1000,FILTER('Table','Table'[Submitted Date]=MAX_SUBMITTED_DATE))

 

I have a seperate Dates table and i have defined relationshiop based on date and reporting date. Year and Month filters are from Dates table. The Measure shows expected output and the table shows your sample data for the selected Year and Month.

image.png 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn

View solution in original post

2 REPLIES 2
VasTg
Memorable Member
Memorable Member

@Anonymous 

 

Try this DAX...

 

Measure = 
VAR MAX_SUBMITTED_DATE = MAX('Table'[Submitted Date])
RETURN CALCULATE((SUM('Table'[Products])/SUM('Table'[Sales]))*1000,FILTER('Table','Table'[Submitted Date]=MAX_SUBMITTED_DATE))

 

I have a seperate Dates table and i have defined relationshiop based on date and reporting date. Year and Month filters are from Dates table. The Measure shows expected output and the table shows your sample data for the selected Year and Month.

image.png 

If it helps, mark it as a solution

Kudos are nice too

Connect on LinkedIn
Anonymous
Not applicable

This works perfectly. Thank you so much!

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.