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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Jana2102
Frequent Visitor

Divide two columns only with values on dimension level en create KPI without dimension

Hallo,

I want to divide two values. In a tabel I can use filter to exclude the blank values but if I take out the dimension rows then the filter doesn't work any more. Here my data:

I want to divide columnA and columnB, but only if columA and columnB have values on the same row (per name):

Jana2102_2-1738927110580.png

In table I can use filter ...is not blank

Jana2102_4-1738927217371.png

But in KPI it just doesn't work:

Jana2102_5-1738927395643.png

Is there any solution in DAX for dit case? The KPI value shoud be 75%.

1 ACCEPTED SOLUTION

Hi @Jana2102 

It is always important that when providing a sample data to describe where the numbers are from.  Also, in the future please post a sample data that we can copy paste to Excel.

 

I modifed my formula a bit to point them to different tables but I am  seeing 75%.

danextian_0-1738932605348.png

danextian_1-1738932633861.png

Please see the attached sample pbix.

 





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.

View solution in original post

4 REPLIES 4
Jana2102
Frequent Visitor

Great work @danextian. This helps me futher. I get the results what I need.

Thank you very much.

danextian
Super User
Super User

Hi @Jana2102 

 

Assuming that columns A and B have multiple rows for each Name and the numbers in your table are aggregates of these rows, try this:

Percentage = 
-- Create a variable _TBL that filters summarized data
VAR _TBL =
    FILTER (
        -- Summarize the table by 'Name' and calculate sums for 'columnA' and 'columnB'
        SUMMARIZECOLUMNS (
            'Table'[Name], -- Group by 'Name'
            "@colA", CALCULATE ( SUM ( 'Table'[columnA] ) ), -- Sum of 'columnA'
            "@colB", CALCULATE ( SUM ( 'Table'[columnB] ) )  -- Sum of 'columnB'
        ),
        -- Remove rows where either @colA or @colB is blank
        NOT ( ISBLANK ( [@colA] ) ) && NOT ( ISBLANK ( [@colB] ) )
    )
RETURN
    -- Calculate the percentage as the sum of @colA divided by the sum of @colB
    DIVIDE ( SUMX ( _TBL, [@colA] ), SUMX ( _TBL, [@colB] ) )

danextian_0-1738928506901.png

 





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.

@danextian thanks for your idea. 
The columns are from 3 different tables:
- 'dim_Employee' [Name]
- 'fact_Hours_Registered' [colA]
- 'fact_Hours_Planned' [colB]

 

With your solution I don't get the result, what I'd like to see. I get 138,6% and not 75%.

Jana2102_0-1738931009653.png

Stil any idea?

 

Hi @Jana2102 

It is always important that when providing a sample data to describe where the numbers are from.  Also, in the future please post a sample data that we can copy paste to Excel.

 

I modifed my formula a bit to point them to different tables but I am  seeing 75%.

danextian_0-1738932605348.png

danextian_1-1738932633861.png

Please see the attached sample pbix.

 





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
May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.