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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
pedroccamaraDBI
Post Partisan
Post Partisan

Value from last day (calendar date)

Hello all

I have this table and a date filter from calendar table.

apagar10.JPG
The date filter is from 5 oct till 11 oct . I want that my measure shows the unit stocks for that last day 11/10 which would be 106 for each SKU column.
Thank you all very much

1 ACCEPTED SOLUTION

Hey @pedroccamaraDBI


Give this a try:

 

Measure =
VAR MaxDate =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date'[Date] ) )
VAR Result =
    CALCULATE ( MAX ( Sales[Qty Day] ), 'Date'[Date] = MaxDate )
RETURN
    Result

 

 

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@pedroccamaraDBI ,Try measure liek

 

calculate(lastnonblankvalue('Date'[Date], sum(Table[Unit stock])  )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Hello @amitchandak 
Many thanks for your answer.
Let me explain you what is my data:
For each day, i have the product code (SKU) the movement id (ID Mov) and the Qty mov, which is how many products were moved and the Qty day which is the balance. I need to know, according with date filter (from dates) the Qty Day of the MAX date on the filter. Which means in this case, it should be 106. Notice that if i may choose 2 or 3 product codes (SKU).
Capture100.JPG

My measure should show 106 in this case because it's the value from the last date chosen.
I'm not sure and even don't know how to, where to do it, but i believe we should have some kind of this: ALL (Products) in that measure, right?
Thanks a lot for your help

Hey @pedroccamaraDBI


Give this a try:

 

Measure =
VAR MaxDate =
    CALCULATE ( MAX ( 'Date'[Date] ), ALLSELECTED ( 'Date'[Date] ) )
VAR Result =
    CALCULATE ( MAX ( Sales[Qty Day] ), 'Date'[Date] = MaxDate )
RETURN
    Result

 

 

Hello @SteveHailey 
Thank you so much for your help. You're the 7th person that i asked for help.
Best regards

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.