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

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
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.