cancel
Showing results for
Did you mean:
Highlighted
Helper I

## Under Over representation

Hi, I am trying to calculate an index to show over or under representation from values relative to the total.

the rows are dimension. so what I want to do is firstly the row calculation as shown already and then dividing it by the coloum total for each cell.  e.g. the first cell should calculate 0.16% divided by 0.22%. Please help

14 REPLIES 14
Highlighted
Super User IV

@vikash_1108 - If I understand correctly, the only thing that would change would be:

``````Measure 9 Row % =
VAR __Age = MAX([Age - Category])
VAR __District = MAX([District - Category])
VAR __Cell = SUM([Member ID])
VAR __All = IF(HASONEVALUE('Table (9)'[District - Category]),COUNTROWS(FILTER(ALL('Table (9)'),[District - Category] = __District)),COUNTROWS(ALL('Table (9)')))
RETURN
DIVIDE(__Cell,__All,0)``````

For __Cell, COUNT would change to SUM

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Highlighted
Helper I

HI Greg,

I Also thought that would work, but it did not.

Regards

Vikash

Highlighted
Super User IV

@vikash_1108 - Oh, yes, I got it, duh. Updated PBIX, Page 17, Table (17). The second measure is identical to the reference changes in the measure and table names.

``````Measure 17 Row % =
VAR __Age = MAX([Age - Category])
VAR __District = MAX([District - Category])
VAR __Cell = SUM([Member Count])
VAR __All = IF(HASONEVALUE('Table (17)'[District - Category]),SUMX(FILTER(ALL('Table (17)'),[District - Category] = __District),[Member Count]),SUMX(ALL('Table (17)'),[Member Count]))
RETURN
DIVIDE(__Cell,__All,0)

Measure 17 Column % of Row % =
VAR __Age = MAX([Age - Category])
VAR __Table = ADDCOLUMNS(SUMMARIZE(FILTER(ALL('Table (17)'),[Age - Category]=__Age),[District - Category]),"__Measure",[Measure 17 Row %])
//    VAR __All = SUMX(__Table,[__Measure])
VAR __All = IF(HASONEVALUE('Table (17)'[District - Category]),CALCULATE([Measure 17 Row %],ALLEXCEPT('Table (17)','Table (17)'[Age - Category])),[Measure 17 Row %])
VAR __Cell = [Measure 17 Row %]
RETURN
//IF(HASONEVALUE('Table (17)'[District - Category]),DIVIDE(__Cell,__All,0),[Measure 17 Row %])
DIVIDE(__Cell,__All,0)``````

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Highlighted
Helper I

Thanks a million @Greg_Deckler - This worked perfectly 🙂

Highlighted
Super User IV

@vikash_1108 Hooray!! 🙂

---------------------------------------

##### I have a NEW book! DAX Cookbook from Packt
Over 120 DAX Recipes!

Proud to be a Super User!

Announcements

#### Power Platform Community Conference

Check out the on demand sessions that are available now!

#### Microsoft Power Platform Communities

Check out the Winners!

#### Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors