Forum Discussion
darpao
5 years agoNew Member
Multiple response and filters
I have a survey that generate 2 tables, one main table like this (Main): ID Year Country 1 2018 UK 2 2019 USA 3 2019 USA 4 2020 Germany 5 2020 USA 6 2018 German...
- 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)
darpao
5 years agoNew Member
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?
ERD
Community Champion
5 years agodarpao ,
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)