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
Following is my data model.
whereas FactSales connect to DimItem table via [ItemId] and DimItem table connects to CurrentHOSStock via [ItemID].
When I use DimItem[product code] and CurrentHOStock[BatchID] and TOTAL QTY = SUM(FactSales[UnitQty]) as measure in table I get following results.
For selected product code, 604903 giving almost all BatchIDs but actually there is only one BatchID for mentioned product code.
Sample pbix file is included.
Solved! Go to Solution.
Hi @Anonymous,
You can merge the three tables by the common column ID and then group them to calculate sum.
After merging into new_table, you can try measure as:
TOTAL QTY =
CALCULATE(
SUM(FactSales[UnitQty]),
FILTER(
ALL(new_table),
'new_table'[Product code]=MAX('new_table'[Product code]) && 'new_table'[BatchID]=MAX('new_table'[BatchID])
)
)
Best Regards,
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
Thank you for your reply @amitchandak .
How can group columns and take desired results? Please help me.
Hi @Anonymous,
You can merge the three tables by the common column ID and then group them to calculate sum.
After merging into new_table, you can try measure as:
TOTAL QTY =
CALCULATE(
SUM(FactSales[UnitQty]),
FILTER(
ALL(new_table),
'new_table'[Product code]=MAX('new_table'[Product code]) && 'new_table'[BatchID]=MAX('new_table'[BatchID])
)
)
Best Regards,
Link
If this post helps then please consider Accept it as the solution to help the other members find it more quickly.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 133 | |
| 88 | |
| 85 | |
| 68 | |
| 64 |