Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get the sum of a category for use in a denominator?

I’m new to DAX and trying to learn/understand it better in Power BI. Here is the sample set of data that I have:

Sample Data

What I would like to do is create a measure that multiplies the [Lead_Points]*[Lead_Modifier] for every row. This was simple enough, and I’ve created such a measure called [Lead_Weight]. Next though is where I’m getting stuck. I want to divide the [Lead_Weight] for each row by the SUM of the [Lead_Weight] for each unique [ID].

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’ve tried to use the SUMMARIZE function to create a virtual table and then use the result of that in a DIVIDE function, but it doesn’t like that because multiple columns are returned.

I’m sure there is a simple answer to this, but I’m having a difficult time understanding the concepts around DAX.

>Solution :

Simple:

Measure =
DIVIDE (
    [Lead_Weight], 
    CALCULATE (
        [Lead_Weight],
        ALLEXCEPT ( 'Table', 'Table'[ID] )
    )
)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading