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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
adriankelly
Frequent Visitor

Column Calculated using Slider Input

Hi,

 

I am a new user of Power BI and am having an issue getting a visual to work.

The table below has fixed values for X and Y is calculated using the formula shown. Power BI 1.JPG

 

The Parameter[Value] is varied by a slider, shown below.

Power BI 2.JPG

But changing the slider value does not change the table values. 

Is there a way to do this?

 
6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi @adriankelly 

First, you should know that:

1. Calculation column/table not support dynamic changed based on filter or slicer.
2. Measure can be affected by filter/slicer, so you can use it to get dynamic summary result in a visual.

https://www.sqlbi.com/articles/calculated-columns-and-measures-in-dax/

 

Second, for your case, you just could just create a simple measure as below:

Y = SUM('Table'[X]) - 'Parameter'[Value]

 

And then drag this measure into visual.

6.JPG

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-lili6-msft,

 

Thanks for your response. 

The sample file contained what I was looking for. 

Coming from an excel background the DAX language and operation is a bit confusing .

Is the Y measure below storing the results in an array? 

 

 

hi  @adriankelly 

No, measure will calculate by it row context in a visual. It likes you define a function, then call it by row text in a visual.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks for your help.

 

edhans
Super User
Super User

Calculated columns are calculated at load and not affected by slicers and report interactions. You need a measure.

 

Y = 
VAR CurrentXValue = MAX('Table'[X])
VAR Result = CurrentXValue - [Selected Value]
RETURN
    Result

 

 

You can see my PBIX file here

Calculated columns appear to be very Excel-like, but they are anything but, and should generally be avoided. There are times to use them, but it is rare. Getting data out of the source system, creating columns in Power Query, or DAX Measures are usually preferred to calculated columns. See these references:
Calculated Columns vs Measures in DAX
Calculated Columns and Measures in DAX
Storage differences between calculated columns and calculated tables
Creating a Dynamic Date Table in Power Query



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting
parry2k
Super User
Super User

@adriankelly seems like [Value] is a measure, you should be adding [Y] as a mesure. What actually you are trying to achieve? 

Read this for calculate column and measures.

 

 

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

Visit us at https://perytus.com, your one-stop shop for Power BI related projects/training/consultancy.

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.