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
Anonymous
Not applicable

Create measure that calculates different things based on value in another column

Hi,

 

I have a scenario where I would like to divide two measures I have created, but there is one case where i would like to calculate the percentage differently. 

The measures I have are:

1 - [Number of items]

2 - [$ Profit]

 

For all cases but one a simple 

test = DIVIDE([Number of items], [$ Profit])
 
But I have one case, where I need to divide the numerater by 4.
This is based on a column called "item name" = "togsett"
Is there a way to input this filter in my measure so i can have it all show in one table?
I'm thinking something like this:
% test =
if( 'xyz'$item name = "togsett",
DIVIDE(Divide([Number of items], 4) , [$ Profit]),
DIVIDE([Number of items], [$ Profit]))
 
This is wrong since the if statement can't use the true value as a column value.
Any other suggestions on how to do this?
 
Thanks!
1 ACCEPTED SOLUTION
saraMissBI
Resolver I
Resolver I

Hi @Anonymous 

I suggest you create a calculated column and put the formula you have as it will accept it or create a second measure for that special case and work with two measures. If anyone has a better solution, I would be curious to know

If my reply helps please give kudos 🙂

Thanks!

View solution in original post

1 REPLY 1
saraMissBI
Resolver I
Resolver I

Hi @Anonymous 

I suggest you create a calculated column and put the formula you have as it will accept it or create a second measure for that special case and work with two measures. If anyone has a better solution, I would be curious to know

If my reply helps please give kudos 🙂

Thanks!

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.