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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Vennela
Frequent Visitor

Dynamic calculated column based on slicer selection

Hi,

I have a situation where the user wants to select a value from the slicer and the Power BI should calculate the columns based on the selected value. 

Below is a clear explanation of the issue. 

I have table 'A' with Threshold values that go into the slicer (1% - 100%)

Table 'B' with ID column, Network column (contains 1 or 0), and a calculated measure, Rate (in percentage format)

Now, I want to create a calculated column 'Applicable' in Table 'B' that says if the network is 1 and Rate >= selected threshold value, then 1 else, blank.

 

Table 'A'

Vennela_0-1656581752229.png

 

Table 'B'

Vennela_1-1656582202859.png

'Rate' measure in Table 'B' looks like below. It is calculated using a different table.

Vennela_2-1656582326060.png

 

I have created a measure 'Applicable', 

Applicable = IF(SUM('Table B'[Network])>0,IF([Rate]>=SELECTEDVALUE('Threshold'[Threshold]),1,0),0)

So whenever I select a value in the 'Threshold' slicer this measure is giving me the right result for each line in the visual but, the grand total is showing as zero (probably it is taking the average). Below is the screenshot.

Vennela_4-1656582924157.png

I want the grand total to show the sum of the 'Applicable' measure (In this case its 3). 

 

Is there a way to use selectedvalue in the column calculation?

I tried using the same dax to calculate a column but the selectedvalue dax is returning a null value.

Any help on this would be appreciated. 

 

Thanks,
Vennela

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Vennela ,

I'm afraid that creating calculated columns doesn't do what you want (dynamically displaying values based on slicer selection). As @amitchandak said, creating a calculated column can't get the values selected by the slicer. You can check the following blogs for the answer...

Calculated Columns and Measures in DAX

Calculated Columns vs Measures

There is a big difference between calculated columns and measures. The value of a calculated column is computed during data refresh and uses the current row as a context; it does not depend on user interaction in the report. A measure operates on aggregations of data defined by the current context, which depends on the filter applied in the report – such as slicer, rows, and columns selection in a pivot table, or axes and filters applied to a chart.

Best Regards

View solution in original post

3 REPLIES 3
Vennela
Frequent Visitor

Hi @amitchandak, Thanks for your response. your solution is working if I create a measure. I can see the grand total showing the sum of the field. 
But, is there a workaround to create a column instead of a measure? as I have to use this column in further calculations which would be at row level hence, it should be a calculated column.

Anonymous
Not applicable

Hi @Vennela ,

I'm afraid that creating calculated columns doesn't do what you want (dynamically displaying values based on slicer selection). As @amitchandak said, creating a calculated column can't get the values selected by the slicer. You can check the following blogs for the answer...

Calculated Columns and Measures in DAX

Calculated Columns vs Measures

There is a big difference between calculated columns and measures. The value of a calculated column is computed during data refresh and uses the current row as a context; it does not depend on user interaction in the report. A measure operates on aggregations of data defined by the current context, which depends on the filter applied in the report – such as slicer, rows, and columns selection in a pivot table, or axes and filters applied to a chart.

Best Regards

amitchandak
Super User
Super User

@Vennela , You need to create measure as column do not take slicer value

 

Try like

Applicable =

sumx(Table, calculate( IF(SUM('Table B'[Network])>0,IF([Rate]>=SELECTEDVALUE('Threshold'[Threshold]),1,0),0) ))

 

 

or

 

sumx(values(Table[ID]), calculate( IF(SUM('Table B'[Network])>0,IF([Rate]>=SELECTEDVALUE('Threshold'[Threshold]),1,0),0) ))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.