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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Maggi029
Helper II
Helper II

How to filter values in column and map the filtered column to slicer

I have a column that looks like this; I need to filter the column only with the main version and the most recent development version and map it to slicer.

Current Column:

Version
"4.3.2"
"5.3.2"
"6.3.2"
"development_7.10"
"development_7.11"

 

 

 

Expected Filtered Column or Measure:

 

Version
"4.3.2"
"5.3.2"
"6.3.2"
"development_7.11"

 

@MFelix  could you please answer this

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Maggi029 .

 

For this I believe you need an additional column to make the Development higlight.

 

On the power query create a new column with the following code:

if Text.AfterDelimiter ([Version] , "_") <> "" then 

Text.PadStart( Text.AfterDelimiter ([Version] , "_"), 6, "0") else ""

I'm assuming that the developement versions will only have 2 number after the dot this will return the following code:

MFelix_0-1661238063893.png

 

Now you can add a flag on DAX:

Slicer Flag = if('Table (2)'[Development_Code] = BLANK() || 'Table (2)'[Development_Code] = MAX('Table (2)'[Development_Code]), 1)

 

If you want to do it only on the Power Query then you can do the following steps:

  • Add a custom column with the following code:
if Text.AfterDelimiter ([Version] , "_") <> "" then 

"Development" else [Version]
  • Do a group by on this column wiht the selection of the maximum of the version number:

 

MFelix_1-1661238521386.png

  • Now do a merge of the table with itself:

MFelix_3-1661238578239.png

 

  • Change the step to get the step before the new column (in my case is the source):

MFelix_4-1661238672099.png

  • Expand the columns making a count:

MFelix_6-1661238753473.pngMFelix_7-1661238779750.png

 

You can replace the 0 by null or just filter out on the slicer.

 

 

 

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

11 REPLIES 11
MFelix
Super User
Super User

Hi @Maggi029 .

 

For this I believe you need an additional column to make the Development higlight.

 

On the power query create a new column with the following code:

if Text.AfterDelimiter ([Version] , "_") <> "" then 

Text.PadStart( Text.AfterDelimiter ([Version] , "_"), 6, "0") else ""

I'm assuming that the developement versions will only have 2 number after the dot this will return the following code:

MFelix_0-1661238063893.png

 

Now you can add a flag on DAX:

Slicer Flag = if('Table (2)'[Development_Code] = BLANK() || 'Table (2)'[Development_Code] = MAX('Table (2)'[Development_Code]), 1)

 

If you want to do it only on the Power Query then you can do the following steps:

  • Add a custom column with the following code:
if Text.AfterDelimiter ([Version] , "_") <> "" then 

"Development" else [Version]
  • Do a group by on this column wiht the selection of the maximum of the version number:

 

MFelix_1-1661238521386.png

  • Now do a merge of the table with itself:

MFelix_3-1661238578239.png

 

  • Change the step to get the step before the new column (in my case is the source):

MFelix_4-1661238672099.png

  • Expand the columns making a count:

MFelix_6-1661238753473.pngMFelix_7-1661238779750.png

 

You can replace the 0 by null or just filter out on the slicer.

 

 

 

 

 

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

 

There is one more requirement in this case, I need to last item(eg: Developement_7.11) is always preselected in slicer.how to achieve that

 

In other words

I've assigned the above version column to a slicer and want the last item (Development_7.11) to be selected in the dropdown slicer whenever I load the power bi report.

 

 

How to achieve the above scenario?

Hi @Maggi029 ,

 

There is no direct way of doing this, do you need that the number of the Development is kept on the slicer or would it be enough just to have development on the slicer and then show that number somewhere else?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

Please ignore above query.

 

Actually I have another requirement related to main question, can you help me to do this.

 

Requirement:

 

Is there any way to set the default value based on the condition?

 

Example : I have a number column and a flag. Here I need to have a slicer with number columns and the default selection would be based on the flag where the flag value=Y then that related number value has to be selected by default.

Hi @Maggi029 , 

 

Has refered there is no direct option to  select a value on a slicer you can do certain workaorounds.

 

Can you please tell me how you have the data?


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Hi @MFelix 

You mean the data format.

As provided in the description , I have a data table has Version column and flag column(created as per your suggestion), datatable will be updated regularly at certain interval.


I have mapped the version column to slicer and i want to be set slicer with default selection, as provided here

Maggi029_0-1661773259152.png



Please let me know, how you are expecting to describe my data?

Hi @Maggi029 ,

 

The Slicer you present is fine in terms of what I need. In this case I would purpose to you to pick the column with the flag, filter out the blank values and select the one from developem to be your default, that way when you have the refresh of the data you would get always the latest one:

MFelix_1-1661778942447.png

 

 

MFelix_0-1661778924414.png

 

Has you can see my current one has a generic name if you don't make any changes to that genereic name the filter will always be picked up. You then can add a card or other type of visualization in order to identify the code.

 

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Stemar_Aubert
Resolver I
Resolver I

I did something simlar a while ago to have a slicer always show the "actual" month.

Create another column in Powerquery and use conditional statements to fill "last version" and "last dev version" (or any other text suitable for you) next to 5.3.2 and Development_6.11 :

 

 

VersionSlicerText
"4.3.2""4.3.2"
"5.3.2"Last version
"development_6.11"Last development version

 

You can then map this column to the slicer and click on what you want to display as default. Updating the table through powerquery, you can have the users always land on "Last version", regardless of what you have above.

 

To automate the process, depending on how you add versions to your table (I imagine manually?) you could create an index in PowerQuery and evaluate the last two rows based on the index. There are others ways, that one is just the first that comes to mind. 

Hi @Stemar_Aubert 

I need to automate the process so that  

 

"The slicer should only contain version numbers (e.g., "4.3.2") and the most recent development (e.g., "development 7.11") values; I need to remove the in-between version ("development 7.10") so that the slicer only contains the values listed below."

 

Can you please share any power query formula to do this filtering?

amitchandak
Super User
Super User

@Maggi029 ,The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi @amitchandak 

 

I need to map the column values listed below to a slicer while excluding some of the values in the column.

 Column:

Version
"4.3.2"
"5.3.2"
"6.3.2"
"development_7.10"
"development_7.11"

 

Conditions:

1.The slicer should only contain version numbers (e.g., "4.3.2") and the most recent development (e.g., "development 7.11") values; I need to remove the in-between version ("development 7.10") so that the slicer only contains the values listed below.

 

Slicer values:

 

Version
"4.3.2"
"5.3.2"
"6.3.2"
"development_7.11"

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! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.