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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
benqpbi
Helper I
Helper I

calculate value based on another column set of values

i have calculated my percentage by using this calculation 

 

Measure = DIVIDE(CALCULATE(SUM('Table Name'[comp_record])),CALCULATE(SUM('Table Name'[comp_record]),ALL('Table Name'))
 
now i have a column named level which has many values but i want to only calculate the above measure for level 4,5,6 only else blank 
benqpbi_0-1681118133127.png

 

3 REPLIES 3
danextian
Super User
Super User

Hi @benqpbi 

 

The measures below change the filter context in your denominator

=
//shows the value each for 4 or 5 or 6

CALCULATE (
        SUM ( 'Table Name'[comp_record] ),
        FILTER ( 'Table Name', 'Table Name'[Level] IN { 4, 5, 6 } )
    )
=
//shows the total value 4, 5 and 6 regardless of filter applied to table 'Table Name'[Level]

CALCULATE (
        SUM ( 'Table Name'[comp_record] ),
        FILTER ( ALL ( 'Table Name'[Level] ), 'Table Name'[Level] IN { 4, 5, 6 } )
    )
=
//shows the total value 4, 5 and 6 regardless of filter applied to table 'Table Name'

CALCULATE (
        SUM ( 'Table Name'[comp_record] ),
        FILTER ( ALL ( 'Table Name' ), 'Table Name'[Level] IN { 4, 5, 6 } )
    )

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

hello, thank you

i have a doubt how it would calculate the percentage because i need to first calculate the percentage by using this 

Measure = DIVIDE(CALCULATE(SUM('Table Name'[comp_record])),CALCULATE(SUM('Table Name'[comp_record]),ALL('Table Name')) 

then ony calculate the percentage only for level 3,4,5

Hello, my suggestions were only for the denominator which is the second argument in your divide formula. Alternatively, you can modify your formula to show the value only if it meets a certain condition

=
IF (
    SELECTEDVALUE ( 'Table Name'[Level] ) IN { 4, 5, 6 },
    DIVIDE (
        SUM ( 'Table Name'[comp_record] ),
        CALCULATE ( SUM ( 'Table Name'[comp_record] ), ALL ( 'Table Name' ) )
    )
)

 

Answers provided are based on the information provided. You can provide more details - sample data and expected result https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/3175712#M1071... 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 Power BI update to learn about new features.