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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
zainqazi96
Regular Visitor

DAX query for alternative of what if parameters

Hi Guys!

I'm encountering an problem in which i want to acheive what if parameters functionality because i'm using Report server and it won't work on RS , i need to use same working like pattern , now if i want to get all the values of a column in a measure how can i do it just like SQL query in which e.g select col1 from tab1; i want to achieve same thing in dax

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @zainqazi96 ,

 

You can use reference in the power query first and then convert the table by unpivot column and remove the unwanted columns.

vkongfanfmsft_1-1708672318548.png

vkongfanfmsft_0-1708672269192.png

then create below formula in powerbi, enabling dynamic selection of column name in the slicer.

slicer_by_columnName = VALUES('Table (2)'[Attribute])

vkongfanfmsft_2-1708672364325.png

 

Best Regards,
Adamk Kong

 

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

 

 

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @zainqazi96 ,

 

You can use reference in the power query first and then convert the table by unpivot column and remove the unwanted columns.

vkongfanfmsft_1-1708672318548.png

vkongfanfmsft_0-1708672269192.png

then create below formula in powerbi, enabling dynamic selection of column name in the slicer.

slicer_by_columnName = VALUES('Table (2)'[Attribute])

vkongfanfmsft_2-1708672364325.png

 

Best Regards,
Adamk Kong

 

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

 

 

Sahir_Maharaj
Super User
Super User

Hello @zainqazi96,

 

Can you please try the following:

 

1. Create a Calculated Table

DistinctColumnValues = DISTINCT('TableName'[ColumnName])

 

2. Use the calculated table to create a slicer in your report

 

3. Create a Measure to Reflect the "What If" Selection

DynamicMeasure = 
VAR SelectedValue = SELECTEDVALUE('DistinctColumnValues'[ColumnName], "Default Value")
RETURN
CALCULATE(
    [YourCalculation],
    FILTER(
        'TableName',
        'TableName'[ColumnName] = SelectedValue
    )
)

 

Hope this helps!


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
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ 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
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

@Sahir_Maharaj i don't get it , how can i use column name in slicers , based on dynamic selections

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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