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
harib
Post Patron
Post Patron

How to Pass Slicer selected Value into Calculated column to display the results

 

Hi All,

 

I have create calculated column in Table A like below, however if i filter Date filed from the dimdate table, calculated column values are not changing. 

 

Ex :

Calclulate Column = If(Table A[ Category] in {1,2,3} && NOT(Table A [Produts])  in {11,12,13}, [Total_Sales],BLANK())

 

Total_Sales is a Measure ( Total_sales=sum(Table B(Sales)) ) used in the calcualted column.

 

 

Capture.JPG

 

Joins : Table A (ID) joined with Table B (ID) and Table B (Date) joined with Dim_Date (Date). 

 

Can anyone tel me, if  we filter date in slicer, calcualted column should give the values accordingly.

 

Thanks in Advance.

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @harib ,

 

Inactive the relationship between tableB and dim date then create a measure as below.

Measure =
var tmp = calculatetable(values('tableA'[id]),filter(ALL('tableA'),Table A[ Category] in {1,2,3} && NOT(Table A [Produts])  in {11,12,13}))
return
calculate(sum('tableB'[sales]),filter(ALL('tableB'),'tableB'[id] in tmp&&'tableB'[date] = selectedvalue('Dim date'[date])))

 

Best Regards,

Jay

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

View solution in original post

4 REPLIES 4
PijushRoy
Super User
Super User

Hi,

Please change relationship between Fact table and DimDate Table
Date should be filder from DimDate Table to Fact Table
If DImDate Table having Duplicate Date, please make it unique 
PBI1.JPG

If you have any question, please let me know.
If solve your requirement, please mark this answer as SOLUTION
If this comment helps you, please LIKE this comment/Kudos

 

 

v-jayw-msft
Community Support
Community Support

Hi @harib ,

 

Inactive the relationship between tableB and dim date then create a measure as below.

Measure =
var tmp = calculatetable(values('tableA'[id]),filter(ALL('tableA'),Table A[ Category] in {1,2,3} && NOT(Table A [Produts])  in {11,12,13}))
return
calculate(sum('tableB'[sales]),filter(ALL('tableB'),'tableB'[id] in tmp&&'tableB'[date] = selectedvalue('Dim date'[date])))

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
harib
Post Patron
Post Patron

@amitchandak 

 

Thanks for the Update.

 

You mean to say we can't impact the calculated column by selecting the slicer values?.

If not is there any possiblity to create same condition in Measure

 

(Calclulate Column = If(Table A[ Category] in {1,2,3} && NOT(Table A [Produts])  in {11,12,13}, [Total_Sales],BLANK()))

 

Thanks

amitchandak
Super User
Super User

@harib , No you can not use a slicer value in a calculated column as of now

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.