The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
Dear wrinkle brains
I have the following dim table:
Supplier:
Supplier_ID | Supplier_Name |
s1 | example_1 |
s2 | example_2 |
and the following two fact tables:
Purchase:
Purchase_ID | Order_Date | Purchase_Supplier |
p1 | 18.3.2023 | s1 |
p2 | 19.3.2023 | s2 |
p3 | 20.3.2023 | s1 |
Supply:
Purchase_ID | Supply_Date |
p1 | 24.3.2023 |
p2 | 27.3.2023 |
p3 | 28.3.2023 |
I added the following measure to my measure table:
TimeDiff = DATEDIFF(max('Purchase'[Order_Date]),max(Supply[Supply_Date]),DAY)
Now i want to show the average of the TimeDiff for every supplier (and filter the visual based on the supplier).
Every hint or example very appreciated!
Cheers!
Solved! Go to Solution.
Hi, @Rudd_ThreeTrees
You can try the following methods.
Measure:
Average =
Var _table = SUMMARIZE(Purchase,Purchase[Purchase_ID],Purchase[Purchase_Supplier],"Timediff",[TimeDiff])
Return
AVERAGEX(FILTER(_table,[Purchase_Supplier]=MAX(Supplier[Supplier_ID])),[Timediff])
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Rudd_ThreeTrees
You can try the following methods.
Measure:
Average =
Var _table = SUMMARIZE(Purchase,Purchase[Purchase_ID],Purchase[Purchase_Supplier],"Timediff",[TimeDiff])
Return
AVERAGEX(FILTER(_table,[Purchase_Supplier]=MAX(Supplier[Supplier_ID])),[Timediff])
Is this the result you expect?
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.