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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

Change calculation of a column based on a slicer

I have a scenario im trying to do but i am struggling to work out how.
My colleague has done it in Tableau, and i dont want to admit that PowerBi cant do it, it must be able to and i just dont know how.

Image below, shows on the left, what the raw data looks like.

What i want to do, is have a display like the Table on the right hand side, where the column "Period 1 Qty Sold" is calculated only for the rows that are for the PromoPeriod that is selected on the first Slicer on the left.
Then i want the column "Period 2 Qty Sold" to be calculated only for the rows that are for the PromoPeriod that is selected on the second slicer on the right.

 

Is this possible?

 

Untitled.png

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

I think you'll need to duplicate the promo period column (lets call it PromoPeriod2)

 

Have slicer 1 as PromoPeriod and slicer 2 as PromoPeriod2

 

Promo 1 Qty Sold = CALCULATE(SUM(Tbl[QtySold]),ALLSELECTED(Tbl[PromoPeriod]))

Promo 2 Qty Sold = CALCULATE(SUM(Tbl[QtySold]),ALLSELECTED(Tbl[PromoPeriod2]))

 

I think you'll need to remove the slicer relationship from your table also.

View solution in original post

v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may create two slicer tables use Slicer 1 = DISTINCT(Test[PromoPeriod]) first. Then you may create the measures as below to get the value as requested.

Period 1 Qty Sold =
CALCULATE (
    SUM ( Test[QtySold] ),
    FILTER ( Test, Test[PromoPeriod] IN VALUES ( 'Slicer 1'[PromoPeriod] ) )
)
Period 2 Qty Sold =
CALCULATE (
    SUM ( Test[QtySold] ),
    FILTER ( Test, Test[PromoPeriod] IN VALUES ( 'Slicer 2'[PromoPeriod] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
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
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous

 

You may create two slicer tables use Slicer 1 = DISTINCT(Test[PromoPeriod]) first. Then you may create the measures as below to get the value as requested.

Period 1 Qty Sold =
CALCULATE (
    SUM ( Test[QtySold] ),
    FILTER ( Test, Test[PromoPeriod] IN VALUES ( 'Slicer 1'[PromoPeriod] ) )
)
Period 2 Qty Sold =
CALCULATE (
    SUM ( Test[QtySold] ),
    FILTER ( Test, Test[PromoPeriod] IN VALUES ( 'Slicer 2'[PromoPeriod] ) )
)

1.png

 

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you so much! Thats exactly what i needed!!!!!

Anonymous
Not applicable

I think you'll need to duplicate the promo period column (lets call it PromoPeriod2)

 

Have slicer 1 as PromoPeriod and slicer 2 as PromoPeriod2

 

Promo 1 Qty Sold = CALCULATE(SUM(Tbl[QtySold]),ALLSELECTED(Tbl[PromoPeriod]))

Promo 2 Qty Sold = CALCULATE(SUM(Tbl[QtySold]),ALLSELECTED(Tbl[PromoPeriod2]))

 

I think you'll need to remove the slicer relationship from your table also.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.