Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
xadya
Frequent Visitor

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:

 

Knipsel.PNG

 

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:

Knipsel`1.PNG

 

But now when I select a city on my map, it automatically makes my selection to fit 100%:

Knipsel14.PNG

 

While I would just want this to stay 0.9%. Is there any way this is possible?

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

@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

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot! I never thought about the ALLEXCEPT as a solution for this, but it makes sense!

xadya
Frequent Visitor

Anyone has an idea?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.