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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

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
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors