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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
moltra
Helper IV
Helper IV

How to create measure that selects what value to use as the denominator in Divide.

I fixed it in one of the reference measures.   Never did figure out how to select a variable to use in a expression like divide.

 

I am trying to create a measure where the denominator changes based on the shared axis value. 

I need to change the Denominator depending on what is being Calculated.

I have tried IF statements, but will not allow me to use the Table column or measures that show the value to be used as the Logic test.

 

I know the below code is not all correct, but it should get the question across.

 

i.e.

 

 

TotalSalesRatio = 

Var Totalsalespeople = [AllSalesPeople]
Var TotalsalesoneSalesperson = [SalesPerson]
Var DesiredReportSales = ""

    If([DesiredReport]="all",
       AllSalesPeople,
       TotalsalesoneSalespPerson)

Divide([TotalSales],DesiredReportSales,0)

 

 

1 ACCEPTED SOLUTION
moltra
Helper IV
Helper IV

I fixed it in one of the reference measures.   Never did figure out how to select a variable to use in a expression like divide.

I added a filter in one of the reference measures so that the data sent to the divide calculation had the required information.

View solution in original post

4 REPLIES 4
moltra
Helper IV
Helper IV

I fixed it in one of the reference measures.   Never did figure out how to select a variable to use in a expression like divide.

I added a filter in one of the reference measures so that the data sent to the divide calculation had the required information.

moltra
Helper IV
Helper IV

What I need to be returned by the measure.  I have highlighted the number that I need to be able to select via an if statement or someother command.

 

 Total Power(input)Peak Power(Input)Ratio (output)
Area1 5531.689812.9156.37% 
Area2819.261211.0068%

What I am getting returned by the measure

 
Total Power(input)
Peak Power(input)Ratio(output)
Area15531.689812.9156.37%
Area2819.263459.0223.68%
moltra
Helper IV
Helper IV

I have a Visual that needs to be different during the week than it is on weekends.  During the week, the measure is based on a weekly peak of a subset of equipment.  On the weekends it is the Peak of all the equipment. 

 

I need to figure out how to calculate the Ratio for the total power used divided by both the "Weekly Peak of subset of equipment" and "Peak of all the equipment", one at a time.

 

This visual needs to have the ratio for total Power used divided by  both the Subset and all calculated values.

Pragati11
Super User
Super User

Hi @moltra ,

 

Your query is not making any sense. The only thing I understand here is you want to use DIVIDE function in DAX but you are not able to use it.

 

Add some sample data and expected output to show what your actual requirement is.

 

Thanks,

Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.