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
okusai3000
Helper IV
Helper IV

Slicer for replacing one column for another

Hello everyone,

 

I’m working on a supplier’s report where I am showing how much is the amount that we spent on each of them along the time. The values come from a single table where I have one column for the final amount, and another one without the VAT.

With the intention of showing my charts and measures with and without VAT, I have created 2 identical pages, using measures that use one or another from the previous column.

For instance:

*Purchases with VAT = sum('Prov'[Total])

 

*Purchases without vat = sum('Prov'[Base Imponible])

 

Idea: I would like to switch between those 2 columns with a simple button or slicer. This would allow me to avoid to have almost duplicated every single measure and to also avoid using 2 identical pages.

 

Is something like this possible?

 

captura tabla.PNG

 

 

Thanks!

2 REPLIES 2
novilpawar
Advocate I
Advocate I

@okusai3000  hi

Yes, it is posible from both slicer and button.

i am showing by slicer. follow my steps

step1:- Create table with your measure name  which you want to replace.

like

slicer_table

Name                                                Value

Purchases with VAT                             1

Purchases without vat                         2

Note:- create Value  datatype  as string.

 =>create a slicer with slicer_table[Name] to select measure

 

step2:- Create one measure to identify what you selected in slicer.

 

selected_measure(vat or w vat) = if (  HASONEVALUE(slicer_table[Name]) , values(slicer_table[Value]) ,<else>)

=> in else part you can give default value(1 or 2) which you want to show when nothing is silected in slicer.

 

step3:- Create one new measure which you are going to use in your visuals.

 

Final_measure = if ( [selected_measure(vat or w vat)] = "1",  [Purchases with VAT ], [Purchases without vat ] )

 

=>Now you can use Final_measure in your visuals insted of using [Purchases with VAT ] and [Purchases without vat ]. It will exchange your measures dynamically based on what you selected in slicer.

 

Hopefully this will work for you.

 

Regards

Novil

If I answer you question, please mark my post as solution.

Anonymous
Not applicable

Hello @okusai3000 

 

Create a table 'MeasuresDefinition' with two columns:

Column1: MeasureID 

Column2: MeasureName

MeasureID     MeasureName

1                    Purchases with VAT

2                    Purchases without vat

 

Now create a slicer with the column MeasureName.

 

All the concerned visualizations should have

SWITCH(SELECTEDVALUE(MeasuresDefinition[MeasureID]),1,sum('Prov'[BaseImponible]),2,sum('Prov'[BaseImponible]))))

 

instead of,

sum('Prov'[Base Imponible]), or,

sum('Prov'[Base Imponible])

 

Regards

Adarsh

If I answer your question, please mark my post as a solution.

 

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.