Forum Discussion
Calculating absolute percentage with interactions
Hey all,
I have a dataset with tweets of all over the world. One visualization I have includes a map of locations of Tweets:
I can select based on city and what I want to do is to calculate the percentage of tweets from that country.
In DAX I now have: CALCULATE(COUNT('finalSet1-100927'[Country]) / CALCULATE(COUNTROWS('finalSet1-100927'); 'finalSet1-100927'[Country] <> "NA"))
NA is to filter out countries without a location. It calculates it perfectly:
But now when I select a city on my map, it automatically makes my selection to fit 100%:
While I would just want this to stay 0.9%. Is there any way this is possible?
- Anonymous8 years ago
xadya,
Please check if the DAX below returns your expected result. If not, please share sample data of your original table.Measure = CALCULATE(COUNT('finalSet1-100927'[Country]);ALLEXCEPT('finalSet1-100927';'finalSet1-100927'[Country])) / CALCULATE(COUNTROWS('finalSet1-100927'); 'finalSet1-100927'[Country] <> "NA";ALL('finalSet1-100927'))
Regards,
Lydia
3 Replies
- AnonymousNot applicable
xadya,
Please check if the DAX below returns your expected result. If not, please share sample data of your original table.Measure = CALCULATE(COUNT('finalSet1-100927'[Country]);ALLEXCEPT('finalSet1-100927';'finalSet1-100927'[Country])) / CALCULATE(COUNTROWS('finalSet1-100927'); 'finalSet1-100927'[Country] <> "NA";ALL('finalSet1-100927'))
Regards,
Lydia- xadyaFrequent Visitor
Thanks a lot! I never thought about the ALLEXCEPT as a solution for this, but it makes sense!
- xadyaFrequent VisitorAnyone has an idea?