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

Simple DAX function?

@Phil_Seamark - calling on you for your power BI wizard-like capabilities!

 

I am trying to write what I think would be a simple DAX function without an operation.

 

Two columns:

 

  • Customer Spend
  • Cost per Thousand

 

Calculation should be Customer Spend/Cost per Thousand * 1000 = Number of Units

 

Any suggestions...when I put an operation in front of the numerator and denominator the calculation works, but I get an incorrect answer.

 

Johnny has a $500 budget to purchase apples.  The cost for apples is $20 cost per thousand.  How many apples can Johnny buy based on his budget.  $500/$20*1000 = 25,000 apples.

1 ACCEPTED SOLUTION

@Anonymous I'm assuming you have a table with each row having a cost per thousand and a price and you are trying to calculate units for each row?  You need a calc column for something like that, unless you are trying to evaluate the expression for every row AND THEN summarize (i.e. sum, average etc.) in which case you could use a SUMX or similar function.

 

In any event, once you load your data to the data model, you can use DAX by right clicking on the table name and choosing Calculated Column.  Then write your function.

 

I would recommend doing simple calc columns like this in query editor if possible.  You will get better compression and performance of the data model if you add the column there rather than with DAX.

View solution in original post

4 REPLIES 4
vanessafvg
Community Champion
Community Champion

@Anonymous 

what are you expecting?

measure = divide($500, ($20 * 1000))





If I took the time to answer your question and I came up with a solution, please mark my post as a solution and /or give kudos freely for the effort 🙂 Thank you!

Proud to be a Super User!




@Anonymous I'm assuming you have a table with each row having a cost per thousand and a price and you are trying to calculate units for each row?  You need a calc column for something like that, unless you are trying to evaluate the expression for every row AND THEN summarize (i.e. sum, average etc.) in which case you could use a SUMX or similar function.

 

In any event, once you load your data to the data model, you can use DAX by right clicking on the table name and choosing Calculated Column.  Then write your function.

 

I would recommend doing simple calc columns like this in query editor if possible.  You will get better compression and performance of the data model if you add the column there rather than with DAX.

dkay84_PowerBI
Microsoft Employee
Microsoft Employee

I think this should be a calc column not a measure.  Is that what you have tried?

Anonymous
Not applicable

I haven't tried that.  Can you offer some details on how to do, and the expression itself?

 

Thank you!

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.