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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jeffgarlisch
Helper I
Helper I

Dynamic Difference of Percentage of Column Total

Hello All Im working with a matrix that looks like so. 

 

Capture.JPG

 

I am calculating the % Diff column using these three DAX formulas

 

 

Calculates % of Column Total for all Categories

%OfAllTotal = Divide([Total Qual],CALCULATE([Total Qual],ALL(QUALNUMJULY[Qualification],QUALNUMJULY[CAI],QUALNUMJULY[DBAName],QUALNUMJULY[AccountNumber])))
Calculates total records

Total Qual = COUNT(QUALNUMJULY[Qualification])

 

 

Calculates the % Difference between Column Totals Based on available data sources

% Diff All = CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<A>") - CALCULATE(CALCULATE(QUALNUMJULY[%OfAllTotal],QUALNUMJULY[SourceIdentification] = "<Y>"))

 

 

The % Difference should always be calculated as DataSource A - DataSource Y.

 

At the moment there are only two data sources, in the future there will be many more, DataSource C, D, E....

 

Datasource Y will be a constant value, and Datasource A will change per Datasource.

 

 

 

My question is if there is a way to calculate the difference in % of column total dynamically, where I dont have to write a separate formula for each data source as they appear in the data? 

 

 

Thanks in Advance!

 

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @jeffgarlisch,

 

Is the table structure of your DataSource A, B, C the same?

 

In additon, I'm a little confused about that what you want to do.

 

Do you want to replace the Data source A with C,D,E? Or you will add more data source for this report and calculate the Data source A - DataSource Y, Data source C - DataSource Y  and Data source D - DataSource Y?

 

Best  Regards,

Cherry

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

Hi @v-piga-msft thanks for your reply!

 

Its all one single dataset but with an ID column for the source of the data. Which at the moment only contains two distinct IDs, but will later expand. 

 

So like you said I will be adding more datasources for this report and looking to have columns displaying the distinct  % difference for each indiviudal data source arranged in a matrix visual style similar to the one below, but with added column headers for each new data source.. 

 

Heres a mockup example I made in Gimp. It should look like this. 

 

 

2018-08-09 07_48_00-QualCalcssstest - Power BI Desktop.png

 

 

  

Thanks!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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