Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I would like to summarize the batch numbers by movement type. For example, Batch 3T36 has multiple entries. They all have the same movement type but different dates. I would like to take the average of the 'Posting Date' for Movement Type 901 for the Batch number.
Solved! Go to Solution.
Hi @Anonymous ,
Based on the information, try using the following DAX formula to calculate the date.
Measure1 =
VAR FirstPosting =
CALCULATE(
FIRSTDATE(TEST[Posting Date]),
TEST[Movement Type] = "901",
TEST[Plant] = "FRPB"
)
VAR LastPosting =
CALCULATE(
LASTDATE(TEST[Posting Date]),
TEST[Movement Type] = "901",
TEST[Plant] = "FRPB"
)
VAR MidPosting =
FirstPosting
+ INT(DATEDIFF( FirstPosting, LastPosting, DAY ) / 2)
RETURN
MidPostingMeasure2 =
VAR FirstPosting =
CALCULATE(
FIRSTDATE(TEST[Posting Date]),
TEST[Movement Type] = "68C",
TEST[Plant] = "FRAA"
)
VAR LastPosting =
CALCULATE(
LASTDATE(TEST[Posting Date]),
TEST[Movement Type] = "68C",
TEST[Plant] = "FRAA"
)
VAR _date =
FirstPosting
+ INT(DATEDIFF( FirstPosting, LastPosting, DAY ) / 2)
RETURN
_dateMeasure days = DATEDIFF([Measure1], [Measure2], DAY)
Then, drag the measure to the card visual.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
Based on the information, try using the following DAX formula to calculate the date.
Measure1 =
VAR FirstPosting =
CALCULATE(
FIRSTDATE(TEST[Posting Date]),
TEST[Movement Type] = "901",
TEST[Plant] = "FRPB"
)
VAR LastPosting =
CALCULATE(
LASTDATE(TEST[Posting Date]),
TEST[Movement Type] = "901",
TEST[Plant] = "FRPB"
)
VAR MidPosting =
FirstPosting
+ INT(DATEDIFF( FirstPosting, LastPosting, DAY ) / 2)
RETURN
MidPostingMeasure2 =
VAR FirstPosting =
CALCULATE(
FIRSTDATE(TEST[Posting Date]),
TEST[Movement Type] = "68C",
TEST[Plant] = "FRAA"
)
VAR LastPosting =
CALCULATE(
LASTDATE(TEST[Posting Date]),
TEST[Movement Type] = "68C",
TEST[Plant] = "FRAA"
)
VAR _date =
FirstPosting
+ INT(DATEDIFF( FirstPosting, LastPosting, DAY ) / 2)
RETURN
_dateMeasure days = DATEDIFF([Measure1], [Measure2], DAY)
Then, drag the measure to the card visual.
Best Regards,
Wisdom Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
@Anonymous sorry not clear what is the expected output, could you please clarify that?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Hi, I would like to have a measure using
Measure 1= average date for batch # with movement type 901 at Factory FRPB – Measure 2 = average date for batch number with movement type 68C at FRAA.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 28 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |