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
nataliafm31
Frequent Visitor

Multiply Columms

Hello!

Anyone could help me, pls? I need to multiply two values, but they have a conditional. For example: I need to multiply the number of fruits per some tax, but the tax depends of the kind of fruit, like
(

Fruit Tax = IF('Fruits'[fruit_name]="Banana";[Banana Tax];IF('Fruits'[fruit_name]="Apple";[Apple Tax];[Orange Tax])) -> it's a columm.

 

Fruit Type       Count of fruits          TAX        Value
Apple                  500                       0.2             X
Banana               200                        0.1             Y

Orange               350                        0.5             Z

How can I obtain X, Y and Z? There is any way, without creat a filtered value for each fruit and than, multiply per Fruit Tax?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

Information provided in a couple of posts, not making it clear. But summarize can help if data is at multiple levels

sumx(summarize(Table,Table[Fruit Name],"_Sum",sum(Table[Fruit Qty]),"_Max",Table[Tax]),[_Sum]*[_Max])

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

Information provided in a couple of posts, not making it clear. But summarize can help if data is at multiple levels

sumx(summarize(Table,Table[Fruit Name],"_Sum",sum(Table[Fruit Qty]),"_Max",Table[Tax]),[_Sum]*[_Max])

 

Thank You so much! 🙂

It worked - I just replace Table[Tax] per its expression - I could not call it directly since it is a calculated columm and wasnt allowed when I tried here.

 





 

VasTg
Memorable Member
Memorable Member

@nataliafm31 

 

 

Could you split the data into two tables?

One with Fruit name and corresponding tax and the other with fruit name, cnt of fruits. Define a relationship based on fruits column and create a measure directly. Please post complete sample input data. I could not related the measure you have with the provided sample.

Connect on LinkedIn

@VasTg I can split - one table with "fruit_name" and Quantity and other table with "fruit_name" and its taxes and use a related function. The problem is that quantity is a calculated value and taxes is a function that depends of fruit type.

I can't share my data, it's confidential, but i will try to give a better example:

register_id      type_of_fruit     col_3         col_4     col_5
4512d           banana             ...               ...          ...   

s345c3          apple
457120         orange
48762w         apple

Then, I created some calculated measures: Banana_tax, Orange_tax, Apple_tax as float numbers (ex: Banana_tax = 0,07).

And so, I created a calculated columm, with the conditional I wrote before, to define the correct tax for each fruit. Finally, I want to multiply the correct tax X count(register_id) for each type of fruit.

I tried to use so many aproaches, but none worked until now 😞




Hi @nataliafm31 

Measure suggested by amitchandak should work.
If it is sloved, could you kindly accept it as a solution to close this case?
If not, please let me know.
 
Best Regards
Maggie

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.