Forum Discussion
Filtering Values based on date, in unrelated tables
Thanks for the reply.
I am attaching the link to my problem using a sample data set.
We have data for a gym. There are three imported tables:
1- Customer Info ( Customer Name, Address, Phone) : Contains Customer info
2- WeightRecords (Customer Name, Record Date, Weight) : Contains monthly weight record of each customer
3- DietPlans (Customer Name, DietPlanStartdate, DietPlanEndDate): Contains info of any diet plan a customer follows
A date table is craeted inside pbix file using Calendar function.
Relationships:
Date: WeightRecords (1:many)
Customer: WeightRecords (1:many)
Customer: DietPlans (1:many)
Date: DietPlans (1:many)
Customer follow different diet plans, and we want to know their average weight six months before the DietPlanEnddate, and average weight six months afterwards. For example, if the customer completed a diet plan on July 7, 2021, i want to know their avg weight for Jan to June 2021, and avg weight for Jul to Dec 2021. Then calculate the difference. I want it to be displayed as a table visual as follows:
Here is the link to the pbix file:
https://drive.google.com/file/d/1zN_snC1qFotYPVpotjHRCJSK-YFUipgS/view?usp=drive_link
I have been trying to do it by calculated column and measure, but the intellisense does not recognize DietPlans table for filter condition.
Avg weight before=
I have tried filtering the WeightRecords table with Date table, but it doesnt recognize it either.
Any help is appreciated. Please keep in mind that are other tables in the data model for RunningPlan (like diet plan) and RunningTimeRecord (like weight Records). So the Customer and Date table will have relationships with these tables too.
Thank you.
- lbendlin2 years agoSuper User
please check the link, it asks for access