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

Measure to return category values for each brand

Hi,

 

I am just getting started with DAX so apologize for what I think is a simple question. I have not been able to find a question quite like mine in the forum but it's possible I couldn't find the right way to search it so please bear with me.

I have a table that shows growth rates by brand where each brand might belong to a different category. I have the first 3 columns of this table working correctly. I need to fetch a value for the 4th column that identifies which category we're dealing with and pull the growth rate for that category.

In Excel I would have done this using a lookup, how do create that kind of logic in DAX? Find category (e.g. candy, then return growth rate for candy)

In my current connection to this database I can only create measures, not columns or tables (it's been disabled by our IT team).

Thanks so much and apologize for what I know is an unclear question. I can fill in the gaps if you tell me what else I can provide

 

CategoryBrandGrowth Rate BrandGrowth Rate for Category
ChocolateBrand A6%5%
CandyBrand B12%2%
CandyBrand C-3%2%
ChocolateBrand D14%5%
3 REPLIES 3
Icey
Community Support
Community Support

Hi @Anonymous ,

 


Category Brand Growth Rate Brand Growth Rate for Category
Chocolate Brand A 6% 5%
Candy Brand B 12% 2%
Candy Brand C -3% 2%
Chocolate Brand D 14% 5%


Is the "Growth Rate for Category" column the result you want? 

If it is, how did you get it? 

If not, what's the result you want? Could you share us more details?

 

 

Best regards

Icey

 

If this post helps, then consider Accepting it as the solution to help other members find it faster.

 

VijayP
Super User
Super User

@Anonymous 

you can use SELECTEDVALUE Funciton

SWITCH(TRUE(),

SELECTEDVALUE([Category])="Canday", growth of candy,growth of cholocate).

Try this and let me know if you are able to achieve or not

 




Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
MY Blog || My YouTube Channel || Connect with me on Linkedin || My Latest Data Story - Ageing Analysis

Proud to be a Super User!


Anonymous
Not applicable

Hi, thank you for the reply. I couldn't get your expression to work unfortunately

Just a bit more info: I have a list of close to 20 categories and the sales % chg should be iterating at every row depending on the category field that each brand belongs to. 
The sales % chg is a measure that already exists in my database so I'm wondering do I need to define any category names within my expression? Shouldn't the formula recognize that it's dealing with the category in question for that particular row?

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.

Top Solution Authors