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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Anonymous
Not applicable

Multiple value division using dax

Can we divide two columns with multiple values in power bi ?? if yes, then please tell. I am trying to divide two columns with multiple values. the columns are total price and unit price ,...

How can I find Quantity??

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

In my understanding, you want to calculate the total price divided by the unit price to get the quantity.

vkalyjmsft_0-1658287857286.png

Measure is an aggregation operation, which requires context in calculation. Unlike calculated column, which refers to the current row, it can be directly referenced.

I create a sample.

vkalyjmsft_1-1658288443051.png

Here's my solution, create a measure.

Measure =
VAR _T =
    ADDCOLUMNS (
        'Table',
        "Quantity", DIVIDE ( 'Table'[totalprice], 'Table'[unitprice] )
    )
RETURN
    SUMX ( _T, [Quantity] )

You can put customer column and the measure in a table visual to get the seperate quantity of each customer or put the measure in a card visual to get the total quantity.

vkalyjmsft_3-1658289165751.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

View solution in original post

2 REPLIES 2
v-yanjiang-msft
Community Support
Community Support

Hi @Anonymous ,

In my understanding, you want to calculate the total price divided by the unit price to get the quantity.

vkalyjmsft_0-1658287857286.png

Measure is an aggregation operation, which requires context in calculation. Unlike calculated column, which refers to the current row, it can be directly referenced.

I create a sample.

vkalyjmsft_1-1658288443051.png

Here's my solution, create a measure.

Measure =
VAR _T =
    ADDCOLUMNS (
        'Table',
        "Quantity", DIVIDE ( 'Table'[totalprice], 'Table'[unitprice] )
    )
RETURN
    SUMX ( _T, [Quantity] )

You can put customer column and the measure in a table visual to get the seperate quantity of each customer or put the measure in a card visual to get the total quantity.

vkalyjmsft_3-1658289165751.png

I attach my sample below for reference.

 

Best Regards,
Community Support Team _ kalyj

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

 

amitchandak
Super User
Super User

@Anonymous , This a measure

 

Divide(Sum(Table[Total Price]), Sum(Table[Qty]) )

 

You need use measure or aggregation with columns in a measure

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

Helpful resources

Announcements
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.

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.

March Power BI Update Carousel

Power BI Community Update - March 2026

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