Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello,
First of all I would like to thanks you for your help and apologize for my english, this is not my native language.
I am working on a Power BI desktop and I am struggling on a measure I am trying to create, but let me first introduce you to (what look like) my model :
So my data are like :
CUSTOMER table:
ITEM table:
MOVEMENT table:
Let me skip the Calendar table, which I think is pretty clear for everyone 😉
Now what I am trying to do : a measure that give the lastest known state of my stock.
So :
- If we have a data for the selected date, we pick the value
- If we don't have a value, we look for the lastest one.
Exptected :
If I pick the 6th of November :
If I pick the 4th of November :
I can provide de different measure I tried, but since they are mainly tuned by ChatGPT... I don't think it will help a lot....
Thank you again for your help !
Hi, I am not 100% sure about how the fact table looks like, but if there are some missing dates in the fact table, below is one of many ways to achieve it.
Lastest date with stocks: =
VAR _lastnonblankdate =
MAXX (
FILTER (
SUMMARIZE ( Movement, 'Calendar'[Date], Movement[stock_qty] ),
'Calendar'[Date] < MAX ( 'slicer calendar'[Date] )
&& Movement[stock_qty] <> 0
),
'Calendar'[Date]
)
RETURN
_lastnonblankdate
Lastest known stocks: =
VAR _lastnonblankdate =
MAXX (
FILTER (
SUMMARIZE ( Movement, 'Calendar'[Date], Movement[stock_qty] ),
'Calendar'[Date] < MAX ( 'slicer calendar'[Date] )
&& Movement[stock_qty] <> 0
),
'Calendar'[Date]
)
RETURN
CALCULATE ( SUM ( Movement[stock_qty] ), 'Calendar'[Date] = _lastnonblankdate )
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Schedule a short Teams meeting to discuss your question.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
11 | |
10 | |
10 | |
9 |
User | Count |
---|---|
18 | |
13 | |
12 | |
11 | |
8 |