cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ireland111
New Member

Interactive table calculations based off of slicer selection

I'm trying to create a dynamic dataset in Power BI. What i want to do is as far as i am aware not possible in Power BI: 

I want to set a column in the query table to read in what the slicer has been selected for e.g. my formula in the query would be: 1000* slicer value. this column would then be used by subsequent columns to calculate an output. 

 

However as said everything i know about Power BI says you cannot read dynamic data into the query.

 

So what i wanted to do was create a number of measures that create a new table dataset starting from that first point e.g. have a measure running from the slicer to do the initial calculation and then adding measures to that measure to complete the rest of my calculations e.g. i want to replicate the table i would have in the query but in terms of measures.

1 REPLY 1
Sahir_Maharaj
Community Champion
Community Champion

Hello @Ireland111,

 

1. Create a measure that captures the slicer value:

Slicer Value = SELECTEDVALUE('Table'[SlicerColumn])

2. Create measures that use the slicer value to perform calculations:

Calculation = 1000 * [Slicer Value]

3. Use the calculated measures to perform subsequent calculations:

Final Calculation = [Calculation] + 500

 

Keep in mind that measures are calculated at runtime based on the context of the visuals they are used in. Therefore, as you change the slicer selection, the measures will automatically recalculate and update accordingly.

 

Note: Alternatively, you can also use calculated columns instead of measures if you need the dynamic calculation to be part of the data model itself rather than being calculated on the fly.

 

Let me know if you might need further assistance.


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj

Data Scientist | Data Engineer | Data Analyst | AI Engineer

➤ Website: https://sahirmaharaj.com

➤ Email: sahir@sahirmaharaj.com

➤ Lets connect on LinkedIn: Join my network of 10K+ professionals

➤ Want me to build your Power BI solution? Lets chat about how I can assist!

➤ Join my Medium community of 30k readers! Sharing my knowledge about data science and artificial intelligence


Helpful resources

Announcements
May 2023 update

Power BI May 2023 Update

Find out more about the May 2023 update.

Submit your Data Story

Data Stories Gallery

Share your Data Story with the Community in the Data Stories Gallery.

Top Solution Authors