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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Adjust values based on slicer state

I have a dataset with time series, a value, and a location.

 

datetimevaluelocation
26-2-2019 12:154A
26-2-2019 12:3023A
26-2-2019 12:452A
26-2-2019 13:0062A
26-2-2019 13:153A
26-2-2019 12:156B
26-2-2019 12:3045B
26-2-2019 12:458B
26-2-2019 13:008B
26-2-2019 13:152B
26-2-2019 12:153C
26-2-2019 12:304C
26-2-2019 12:454C
26-2-2019 13:006C
26-2-2019 13:154C

 

This data is about electricity meters.

For these time series a have a bar/line chart for the sum(value) of all locations per time interval.

And a bar chart with sum(value) per location.

For analysis purposes, I want to be able to invert the value (value * -1) per location.

Ideally, I can use a standard slicer visual, with a list of all the locations, if a location is unselected the data shown is normal, if a location is selected the data for only the selected locations are inverted (value * -1) and the data is not filtered like the default behaviour of a slicer.

 

Any ideas?

1 ACCEPTED SOLUTION

Hi @Anonymous 

 

You may create a measure like below and use it for the datetime visual.

Measure 2 = 
SUMX(FILTER(Table2,Table2[datetime]=MAX(Table2[datetime])),[invert])

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

4 REPLIES 4
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @Anonymous 

 

You may create a slicer table: Slicer = DISTINCT(Table2[location]).Then use it as slicer.Then you may get the measure like below:

invert = 
IF (
    MAX ( Table2[location] ) in VALUES(  Slicer[location] ),
    SUM ( Table2[value] ) * ( -1 ),
    SUM ( Table2[value] )
)

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

Hi @v-cherch-msft 

 

Thank you. But it doesnt seem to work like i want yet.

In the example pbix you attached;

* if i select no location (ie all values should be original) then all values are * -1. it does work correctly if one or more locations are selected. i managed to fix this myself by putting your code into an IF ISFILTERED

* if i make a column chart with "datetime" on the axis, and "invert" on the values, then it does not behave like i expected. this chart is the ultimate goal of my report. i guess that is because location is not in the chart? is there a way around this?

 

Bonus question:

The slicer table does not seem to respond to filters. Is that possible? What if there was more data and because of an (external) filter there were less locations?

Hi @Anonymous 

 

You may create a measure like below and use it for the datetime visual.

Measure 2 = 
SUMX(FILTER(Table2,Table2[datetime]=MAX(Table2[datetime])),[invert])

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

Fantastic it works thank you. Can you please explain the last measure?

 

SUMX(FILTER(Table2,Table2[datetime]=MAX(Table2[datetime])),[invert])

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors