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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
LeeDubs
New Member

Normalizing Data based on attribute AND selected "Product" selected from a slicer.

I have the below data.  I have unpivoted the data to have the columns Product, Attribute, Value.  Using the following 

Normalized Value = 
VAR MinOfGroup = CALCULATE(MIN('Table'[Value]),ALLEXCEPT('Table','Table'[Attribute]))
VAR MaxOfGroup = CALCULATE(MAX('Table'[Value]),ALLEXCEPT('Table','Table'[Attribute]))
VAR DetailValue = MAX('Table'[Value])
RETURN DIVIDE(DetailValue - MinOfGroup,MaxOfGroup - MinOfGroup,0)

from https://dataveld.com/2017/07/29/using-dax-to-normalize-data-in-power-bi/

 

we can get the normalize values for each Attribute.  However, I really need to be able to filter the data by "Product" using a slicer.  This works but the calculation always using all products to normalize the data between 0 and 1.  How can we get the data normalized always between 0-1 on our bar chart? As you see below, the normalized value doesn't go between 0 and 1.  Many thanks to all.

 

 

ProductSpeedTorquePowerFlowSound
Big Hoopa150003857020090
Tim's Dream160005588060080
First Fury1700066112230078
Last Time Out110003437417587
Musty Mitten100001111032595
Compact Tech13500110148580091
NextGen120008096030077
Tough Tool90004540537578

 

 

LeeDubs_2-1677542664450.png

 

 

 

 

LeeDubs_0-1677542610839.png

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@LeeDubs , Try like

 

Normalized Value =
VAR MinOfGroup = CALCULATE(MIN('Table'[Value]),filter(allselected('Table'),'Table'[Attribute] = max('Table'[Attribute])))
VAR MaxOfGroup = CALCULATE(MAX('Table'[Value]),filter(allselected('Table'),'Table'[Attribute] = max('Table'[Attribute])))
VAR DetailValue = MAX('Table'[Value])
RETURN DIVIDE(DetailValue - MinOfGroup,MaxOfGroup - MinOfGroup,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@LeeDubs , Try like

 

Normalized Value =
VAR MinOfGroup = CALCULATE(MIN('Table'[Value]),filter(allselected('Table'),'Table'[Attribute] = max('Table'[Attribute])))
VAR MaxOfGroup = CALCULATE(MAX('Table'[Value]),filter(allselected('Table'),'Table'[Attribute] = max('Table'[Attribute])))
VAR DetailValue = MAX('Table'[Value])
RETURN DIVIDE(DetailValue - MinOfGroup,MaxOfGroup - MinOfGroup,0)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Wow.  Thank you so much.  This worked.  I have struggled and would have never gotten this.  Can you please breakdown and explain what the code in MinOfGroup (and MaxOfGroup) is doing?  

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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