Forum Discussion
Help with managing relationships
Hi ErikHolmberg ,
Thanks to lbendlin and DataInsights for their quick replies and advice. I have some other ideas to add:
(1) We can create a date table and a Client_Team_ID table.
Date = SUMMARIZE(ADDCOLUMNS(CALENDAR(DATE(2024,1,1),DATE(2024,12,31)) ,"MonthColumn",FORMAT([Date],"yyyy-mm") ),[MonthColumn])Client_Team_ID = VALUES('Budget'[Client Team ID])
(2) Create a column on Budget table.
MonthColumn = FORMAT([Month],"yyyy-mm")
(3) Creating Model Relationships.
(4) Create measures.
budget_amount = SUM('Budget'[Budget amount]) budget_services = SUM('Budget'[Budget # services])count_product =
var _month=FORMAT(MAX('Servicelist'[Start date]),"yyyy-mm")
RETURN COUNTROWS(FILTER(ALLSELECTED('Servicelist'),[Client Team ID]=MAX('Client_Team_ID'[Client Team ID]) && _month= MAX('Date'[MonthColumn])))sale_amount =
var _month=FORMAT(MAX('salesinvoice'[Date]),"yyyy-mm")
RETURN
CALCULATE(SUM('salesinvoice'[Amount]),FILTER(ALLSELECTED('salesinvoice'),[Client Team ID]=MAX('Client_Team_ID'[Client Team ID]) && _month =MAX('Date'[MonthColumn])))
(5) Then the result is as follows.
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks, this helps a lot!
I followed your steps and tested the table visualization. There are a few things I don't fully get working though.
- For sale_amount and count_product it only shows for the last month and not any values for prevouis months
- When I use other visuals(tested with gauge and bar chart) it shows the sale_amount for the Client Team ID with the highest value rather than the sum of the selcted teams. But at the same time it shows the budget_amount only for the selcted teams - this is how I would prefer it to work.
I'd be happy to provide some data, do you want to see all talbes anonymized or anything certain?
Thanks for the help!