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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
gritman
Frequent Visitor

DAX - How to use a Column Value to use in a Measure

Hello everyone, 

 

I would very much appreciate any help and advice on the following please.

 

I have a table and would like to perform some calculations, the inputs to which will change, depending on slicer values.  I think I therefore need to use Measures instead of Columns (?).

 

Below is an example:  the first 3 columns are imported data.  The measure is a sum of the $ Amount per Sales Person - which I performed using CALCULATE(SUM(Sales[$ Amount]), ALLEXCEPT(Sales, Sales[Salesperson]))

 

What I now want to do is $ Amount / Total (e.g. for row 1:  200 / 1000) however I can't seem to do this in DAX.  I've been reading and I understand that is because I can't pass a table as a parameter (I tried (Divide(Table[$Amount], Measure.Total), 0) but that didn't work). 

 

Please can someone advise on a measure that will perform Table.$ Amount / Measure.Total for each row.

Table.DateTable.SalespersonTable.$ AmountMeasure.TotalMeasure.Day % (Help)
1st FebBob200100020%
1st FebJessica200120017%
2nd FebBob300100030%
2nd FebJessica400120033%
3rd FebBob500100050%
3rd FebJessica600120050%

 

The reason I want a measure rather then a Column is so I can have a slider on the date so that if I was to change the date range to just 1st Feb and 2nd Feb as below, the Day % would change.

 

Table.DateTable.SalespersonTable.$ AmountMeasure.TotalMeasure.Day % (Help)
1st FebBob20050040%
1st FebJessica20060033%
2nd FebBob300100030%
2nd FebJessica400120033%

 

Any help would be greatly appreciated.

 

Thanks

 

Gritman

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@gritman add following measures, Total Sales and % Sales

 

 

Total Sales = 
VAR __salesPerson = MAX( Table[Salesperson] )
RETURN
CALCULATE(SUM(Table[$ Amount]), 
ALLSELECTED( Table ), 
Table[Table.Salesperson] = __salesPerson )

% Sales = DIVIDE( SUM( Table[$ Amount] ), [Total Measure] )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

2 REPLIES 2
parry2k
Super User
Super User

@gritman add following measures, Total Sales and % Sales

 

 

Total Sales = 
VAR __salesPerson = MAX( Table[Salesperson] )
RETURN
CALCULATE(SUM(Table[$ Amount]), 
ALLSELECTED( Table ), 
Table[Table.Salesperson] = __salesPerson )

% Sales = DIVIDE( SUM( Table[$ Amount] ), [Total Measure] )

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hi Parry2k, 

 

That worked!  Many, many thanks.

 

Rgds

 

Gritman

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.