Forum Discussion
Child Record count in parent table
Hi Guys,
our data model is like table has Plans, each plan has many promotions and each promotion will have many MPG's.
1. PLAN.ROW_ID [PARENT]
2. PROMOTION.PAR_ROW_ID = PLAN.ROW_ID [M:1]
3.MPG.PAR_ROW_ID= PROMOTION.ROW_ID[M:1]
Senario :: We want No of Promotions & No of MPG's count for each PLAN. Please find the screen for your reference. Suggest me DAX code.
Thanks,
Sharif.
hi sharif
Just create the relationship between three tables as below:
https://docs.microsoft.com/en-us/power-bi/desktop-relationships-understand
Then create two simple measure:
Measure 1=COUNTA([PROMOTION.PAR_ROW_ID])
Measure 2=COUNTA([MPG.PAR_ROW_ID])
Now, just drag [PLAN.ROW_ID] field and these two measure into a visual.
Regards,
Lin
1 Reply
- v-lili6-msft
Community Support
hi sharif
Just create the relationship between three tables as below:
https://docs.microsoft.com/en-us/power-bi/desktop-relationships-understand
Then create two simple measure:
Measure 1=COUNTA([PROMOTION.PAR_ROW_ID])
Measure 2=COUNTA([MPG.PAR_ROW_ID])
Now, just drag [PLAN.ROW_ID] field and these two measure into a visual.
Regards,
Lin