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

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
Anonymous
Not applicable

Calculations based on Conditional Calculated columns

I have a table that splits agents into productive and non-productive minutes using a calculated column.

 

The table visual can perform this split quite well, however, when I want to do calculations based on those split values, it becomes quite difficult.

 

So this is what I have in Power BI:

 

rax99_0-1598347061778.png

 

The columns you can see are derived from a calculated column 'ProductiveSplit' 

The calculation for the 'ProductiveSplit'  column is something like:

ProductiveSplit = IF('PBI DAST'[AgentStateTypeIdent]=117,"NP-Known"
,IF('PBI DAST'[AgentStateTypeIdent]=120,"NP-Unknown"
,IF('PBI DAST'[AgentStateTypeIdent]=124,"NP-Known"...

 

What I need are 2 more columns as illustrated in the image above. The calculations are based on the row values of the calculated column 'ProductiveSplit' 

 

So, Prod% = Prod / (NP-Known NP-Unknown + Prod)
      Known% = (Prod NP-Known) / (NP-KnownNP-Unknown Prod)

 

I have the excel sheet attached of how I need the results to appear below.

 

Excel

 

Any help would be great.

1 ACCEPTED SOLUTION
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create measures like DAX below.

 

Prod% =
VAR _Prod =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "Prod" )
    )
VAR _Total =
    CALCULATE ( SUM ( Table1[PeriodMins] ), ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _Prod, _Total )




Known% =
VAR _Prod =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "Prod" )
    )
VAR _Known =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "NP-Known" )
    )
VAR _Total =
    CALCULATE ( SUM ( Table1[PeriodMins] ), ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _Prod + _Total, _Total )

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-xicai
Community Support
Community Support

Hi @Anonymous ,

 

You may create measures like DAX below.

 

Prod% =
VAR _Prod =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "Prod" )
    )
VAR _Total =
    CALCULATE ( SUM ( Table1[PeriodMins] ), ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _Prod, _Total )




Known% =
VAR _Prod =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "Prod" )
    )
VAR _Known =
    CALCULATE (
        SUM ( Table1[PeriodMins] ),
        FILTER ( Table1, Table1[ProductiveSplit] = "NP-Known" )
    )
VAR _Total =
    CALCULATE ( SUM ( Table1[PeriodMins] ), ALLSELECTED ( Table1 ) )
RETURN
    DIVIDE ( _Prod + _Total, _Total )

 

Best Regards,

Amy 

 

Community Support Team _ Amy

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , if you want hybrid table like the one not possible. I logged an idea

https://ideas.powerbi.com/ideas/idea/?ideaid=9bc32b23-1eb1-4e74-8b34-349887b37ebc

 

Hybrid.png

 

 

There is % wise total option in matrix , column-wise too. right click on periodmins under values and check

refer if those can help

https://www.fourmoo.com/2017/07/18/power-bi-dax-measures-for-excel-based-of-column-total-or-of-row-total/

 

or you can create a new meausre

divide(sum(table[period mins]),calculate(sum(table[period mins]). allexcept(Table,table[productivesplit])))

 

or

 

divide(([period mins]),calculate(([period mins]). allexcept(Table,table[productivesplit])))

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thanks  @amitchandak for your reply.

 

This does kind of work, if I display values as %s. However, I have extra columns that I dont need to show, how do I get rid of them (marked x)?

 

rax99_0-1598355325031.png

 

Also, how can I get the 2nd calculation/column:  Known% = (Prod NP-Known) / (NP-KnownNP-Unknown Prod) ?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.