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
sachin187
New Member

Use slicer value to create calculated field

Hi,

 

What i am trying to do is that i have stats for my sales staff on daily activity. on excel they can select the number of days they worked in a month and a formulae behind the scenes calculates the % of target they have done. For Power BI, i want to select the working days from a Slicer, the slicer is from a table i created with numbers 0-30. Then depending what has been selected, this number is used to get the for e.g. number of calls that sales person has made. 

For e.g.

 

(CallsTotal * 20/(Days chosen by Slicer)) /160- Calls total comes from a table, 160 is the target, 20 is number of days in a month. 

 

How can i create this formulae using the selection from the Slicer??

 

thanks

 

sachin 

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @sachin187

Assume "CallsTotal" and "target" are columns

4.png

 

To make values change with the selection of a slicer, you need create a measure

5.png

 

Then create a table(Table2) with numbers 0-30 disconnected with the sales staff daily activity table(Table1). (do not create any relationship with them)

 

Next, add Table2[days] in a slicer, create measures in the Table1

selected value = SELECTEDVALUE(Table2[days])

% of target = (MAX([calls total])*[selected value])/MAX([target])-MAX([calls total])

3.png

 

 

If "CallsTotal" and "target" are consistent values instead of columns, just input them as values in the formula above, like

% of target = (10*[selected value])/160)-10)

 

Best Regards

Maggie

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @sachin187

Assume "CallsTotal" and "target" are columns

4.png

 

To make values change with the selection of a slicer, you need create a measure

5.png

 

Then create a table(Table2) with numbers 0-30 disconnected with the sales staff daily activity table(Table1). (do not create any relationship with them)

 

Next, add Table2[days] in a slicer, create measures in the Table1

selected value = SELECTEDVALUE(Table2[days])

% of target = (MAX([calls total])*[selected value])/MAX([target])-MAX([calls total])

3.png

 

 

If "CallsTotal" and "target" are consistent values instead of columns, just input them as values in the formula above, like

% of target = (10*[selected value])/160)-10)

 

Best Regards

Maggie

PattemManohar
Community Champion
Community Champion

@sachin187 Assuming that you are all relationships in place, then try using "SELECTEDVALUE" function





Did I answer your question? Mark my post as a solution!

Proud to be a PBI Community Champion




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.