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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Kfitzek2022
Frequent Visitor

Multiplier depending on critera

Hello,

 

I would like to create a measure or column based off critera that will dicate to multiply a set of data or not. In the table below, I would like to multiply anything that has the channel of "Disty" by 6%. Any help would be great! Thank you!

 

ChannelCost
Direct $  100.00
Disty $  200.00
Disty $  100.00
Direct $  500.00
Disty $  600.00
2 ACCEPTED SOLUTIONS
d_rohlfs
Helper I
Helper I

Hey there @Kfitzek2022,

What you need to do is create a DAX Calculated column. The formula should look like this:

Column Name = If('Table'[Channel] = "Disty", 'Table'[Cost] * 1.06, 'Table'[Cost])

 

Screenshot 2023-08-16 123954.png
If this is correct please think about marking it as a solution.

View solution in original post

Oh you're saying you just don't want the Direct cost? Only disty?

Disty Cost = CALCULATE (
        SUM ( 'table'[cost] ),
        'table'[Channel] = "Disty"
    ) * 1.06

Syk_0-1692210760088.png

 

View solution in original post

12 REPLIES 12
Syk
Super User
Super User

A few things to consider when choosing a calculated column vs measure.
https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/#:~:text=The%20difference%20is....

Try the measure I posted earlier to see if you get your desired result.

Hello @Syk I tried your solution as well, and though it works in isolated instances. It also like the column doesn't work when I use certain filters. Any ideas how I get it to apply to when I filter?

Depends on your relationships and the filter.. Can you give an example?

So I added the table below to show sort of what I mean. I'm only using one data source right now, so no relationships have been made. I simply will choose a Company, and it will sum up all the ones labled "Disty" not just Company A for instance.

 

CompanyChannelCost
ADirect $  100.00
BDisty $  200.00
CDisty $  100.00
ADirect $  500.00
ADisty $  600.00

You're trying to sum this up by company? A little confused by this response.
Right now this is what I'm showing by copying your example.

Syk_0-1692210379160.png

If you set Cost to sum, you'll get 

Syk_1-1692210425527.png


And if you want it rolled up by company, just remove the other details

 

Syk_2-1692210462797.png

 



Hey @Syk That is correct. Trying to sum things up by each company. So if I choose Company A, I just want back the sum of the disty cost by company A. I want to be able to do that with each company I select. 

Oh you're saying you just don't want the Direct cost? Only disty?

Disty Cost = CALCULATE (
        SUM ( 'table'[cost] ),
        'table'[Channel] = "Disty"
    ) * 1.06

Syk_0-1692210760088.png

 

This is exactly what I needed! Thank you so much!

d_rohlfs
Helper I
Helper I

Hey there @Kfitzek2022,

What you need to do is create a DAX Calculated column. The formula should look like this:

Column Name = If('Table'[Channel] = "Disty", 'Table'[Cost] * 1.06, 'Table'[Cost])

 

Screenshot 2023-08-16 123954.png
If this is correct please think about marking it as a solution.

This works, but when I filter on other things in the report, it is multiplying all cost still instead of what is filtered. Anyway to get around this? For instance. If had the same table as above but added in one more column for filtering. Example below.

 

CompanyChannelCost
ADirect $  100.00
BDisty $  200.00
CDisty $  100.00
ADirect $  500.00
ADisty $  600.00
Syk
Super User
Super User

 

___measure =
VAR disty =
    CALCULATE (
        SUM ( 'table'[cost] ),
        'table'[Channel] = "Disty"
    ) * 1.06
VAR other =
    CALCULATE (
        SUM ( 'table'[cost] ),
        'table'[Channel] <> "Disty"
    )
RETURN
    other + disty

 

Will this work for you?

Now you have a solution for a column or a measure! 

Syk_0-1692208464111.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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