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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
Anonymous
Not applicable

How to calculate column based on Slicer

Hi everyone,

 

I have a table like the next one:

ID ClassPointsPoints_Norm
1A500
2A8000.1372455
3A9110.15755784
4B45615283.4639301
5B15210.26918418
6B1230.01335856
7C148942.71636296
8C45610.82548594
9C546516100
10C14651626.8023994

 

Also, I have a slicer for the column "Class". My objective is to put the variable "Points_norm "in a graph (it is just the values of "Points" normalized between 0 and 100).

 

What I'm looking for is that, when I select one of the classes with my slicer, I get the normalized values just for the filtered results. In this example, if I select Class==A with the slicer,  what I would get is:

 

ID ClassPointsPoints_Norm
1A500
2A80087.1080139
3A911100

 

Because the normalization is done just for those values I calculated. Does anyone know how to get this in Power BI?

 

Thank you all

3 REPLIES 3
amitchandak
Super User
Super User

@Anonymous , You can not calculate a column with slicer values. You can only use the slicer value in measure. Think how can you use measure in place of column

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

So the idea would be, how to get a measure that scales between 0 and 100 the values that affected the slicer?

@Anonymous , have slicer using what if parameter

assume you need it for points and ID is you min level

 

Try like

total point = sum(Table[Points])

measure =
var _min = minx(allselected(whatif), whatif[value])
var _max = maxx(allselected(whatif), whatif[value])
return
sumx(values(Table[ID]) , if([total point]>=_min && [total point] <=_max, [total point], blank()))

 

or like this, here you can add more than one group by

 

measure =
var _min = minx(allselected(whatif), whatif[value])
var _max = maxx(allselected(whatif), whatif[value])
return
sumx(filter(summarize(Table, Table[ID], "_1", sum(Table[Points])) , [_1]>=_min && [_1] <=_max),[_1])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.