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
Gwendaline_p
Helper I
Helper I

How to calculate a sum depending on only one filter ?

Hi ,

 

Here is an example of what I want :

 

I have the number of purchases by month and by country.

I have two filters : by month and by country.

I choose a month (January 2016) and a country (France) and I want to calculate the sum of purchases for France in January 2016 divided by the sum of purchases for all countries in January 2016.

 

MonthCountryPurchases
January 2016France150
January 2016Italy100
January 2016Belgium250

 

Result : 150 / (150 + 100 + 250) = 30 %

 

How can I do it please ?

 

Thanks for your help !

Gwendaline

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

hello @Gwendaline_p

 

please try with this dax measure.

 

Insert in a card visual

 

% =
DIVIDE (
    CALCULATE ( SUM ( Table1[Purchases] ) ),
    CALCULATE ( SUM ( Table1[Purchases] ), ALL ( Table1 ) ),
    0
)



Lima - Peru

View solution in original post

2 REPLIES 2
Vvelarde
Community Champion
Community Champion

hello @Gwendaline_p

 

please try with this dax measure.

 

Insert in a card visual

 

% =
DIVIDE (
    CALCULATE ( SUM ( Table1[Purchases] ) ),
    CALCULATE ( SUM ( Table1[Purchases] ), ALL ( Table1 ) ),
    0
)



Lima - Peru

It works perfectly.

 

Thank you,

Gwendaline

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.