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
aj1107
Helper I
Helper I

dynamic calculated column based n slicer text value

I got a below scenario. slicer value will be distinct of col1 and col2 and then pass slicer selection value to plan col1 and col2 and create a dynamic calculated column

 

id,issue,plan

1,av,av

2,av,rm

3,rm,av

 

slicer -

distinct(union(issue,plan))

av

rm

 

when slicer value is selected -> case when plan like value(slicer) then "direct" else "indirect"  (if the selected value is available in plan column then dislay direct else indirect)

 

slicer = av

 

table output

id,issue,plan, calc

1,av,av , direct

2,av,rm , indirect

3,rm,av , direct

 

slicer = rm

 

id,issue,plan, calc

2,av,rm , direct

3,rm,av , indirect

 

i tried to implement the  approach using dax. created cal measure  of selected slicer value

selected value= if(hasonevalue(slicer),values(slicer),blanlk()

 

 not sure passing the selected slicer value to create calc column.

 

attchaed code snippet of sql query of above approach.

 

sql.png

 

 

1 ACCEPTED SOLUTION
v-ljerr-msft
Employee
Employee

Hi @aj1107,

 

Not like measures, calculate columns/tables are computed during database processing(e.g. data refresh) and then stored in the model, they do not response to user selections on the report.

 

So it is not possible to create a calculate column/table can change dynamically with user selections on the report.

 

In this scenario, you can create a measure instead, then show the measures on the Table/Matrix visual with the corresponding columns from your table. The formula below to create the measure is for your reference. Smiley Happy

measure = 
IF (
    HASONEVALUE ( Table2[slicer] ),
    IF (
        VALUES ( Table2[slicer] ) = FIRSTNONBLANK ( Table1[plan], 1 ),
        "direct",
        "indirect"
    )
)

m2.PNG

Regards

View solution in original post

1 REPLY 1
v-ljerr-msft
Employee
Employee

Hi @aj1107,

 

Not like measures, calculate columns/tables are computed during database processing(e.g. data refresh) and then stored in the model, they do not response to user selections on the report.

 

So it is not possible to create a calculate column/table can change dynamically with user selections on the report.

 

In this scenario, you can create a measure instead, then show the measures on the Table/Matrix visual with the corresponding columns from your table. The formula below to create the measure is for your reference. Smiley Happy

measure = 
IF (
    HASONEVALUE ( Table2[slicer] ),
    IF (
        VALUES ( Table2[slicer] ) = FIRSTNONBLANK ( Table1[plan], 1 ),
        "direct",
        "indirect"
    )
)

m2.PNG

Regards

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.