Forum Discussion
Multiple response and filters
- 5 years ago
Finally I was able to find the solution.
Thank you ERD because your code helped me.
This is what I was looking for:
#Percentage = VAR main_id = CALCULATE(COUNTROWS('T-main'),REMOVEFILTERS('T-tech'[Technology]))VAR tech_id = COUNT('T-tech'[ID])VAR percentage = tech_id / main_idRETURNCOALESCE(percentage,0)
Hi darpao ,
I suppose your tables are connected via ID column. You can try this measure:
#Percentage =
VAR main_id = COUNT('T-main'[ID])
VAR tech_id = CALCULATE(COUNT('T-tech'[ID]))
VAR percentage = tech_id / main_id
RETURN
COALESCE(percentage,0)If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
Thank you ERD ,
I still get all 1 in the table, like dividing the same amount.
Did you forget the second argument of calculate function in tech_id variable, maybe?
Can you attach the PBIX attemps that you did?
- ERD5 years agoCommunity Champion
darpao ,
I'm not sure what do you mean. You can check what you get by separating the measure:
#tech_id = CALCULATE(COUNT('T-tech'[ID]))#main_id = COUNT('T-main'[ID])If this post helps, then please consider Accept it as the solution ✔️to help the other members find it more quickly.
- darpao5 years agoNew Member
Finally I was able to find the solution.
Thank you ERD because your code helped me.
This is what I was looking for:
#Percentage = VAR main_id = CALCULATE(COUNTROWS('T-main'),REMOVEFILTERS('T-tech'[Technology]))VAR tech_id = COUNT('T-tech'[ID])VAR percentage = tech_id / main_idRETURNCOALESCE(percentage,0)