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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
WILLIAM_AFFONSO
Frequent Visitor

How to highlight the selected month in a table with all months, considering year filter

I need help with a Power BI scenario:

  • The user selects a year (e.g., 2025) using a filter on the page.
  • A single-select slicer displays only the months for the selected year.
  • A table visual shows all months for the selected year. I want only the row for the month selected in the slicer to be marked (for example, with a “XXXXX”), but all months should always be visible in the table.

I have tried to create a DAX measure to compare the slicer selection with the table rows, but I am running into filter context issues.

Download .pbix
What is the recommended way to achieve this?

Thank you in advance!

 

imagem.png

 

2 ACCEPTED SOLUTIONS

Got it. With your current model, there is no way to have a slicer affect a measure in a visual without also affecting the overall filter on the visual. In case you thought of maybe addressing this with "Edit interactions," telling the slicer to not impact your visual will also stop the slicer from impacting the measure inside the visual.

 

So, to achieve what you want, you need to update your model with another calendar dimension table that is not related to your fact table. You can then use a measure with a virtual relationship between the disconnected calendar dimension and your fact table.

 

New Model

Quick notes:

1) I switched your relationship between your calendar dimension and fact to 1:* rather than *:*

2) I set a 1:* relationship from our original calendar to the disconnected calendar, so Dcalendar will filter Dcalendar_Selector, but not other way around

 

MarkLaf_2-1748491320476.png

 

The new table to create:

Dcalender_Selector = Dcalender

 

New Slicer

 

MarkLaf_5-1748492412581.png

 

Measure

 

Selector Calc = 
IF(
    CALCULATE( 
        NOT ISEMPTY( 'Table' ), 
        TREATAS( VALUES( Dcalender_Selector[Date] ), 'Table'[Data] ), 
        'Table' 
    ),
    "XXXXX" 
)

 

Now you can see the disconnected will impact the measure without impacting the visual, unlike the original slicer

 

MarkLaf_4-1748492233631.gif

 

 

View solution in original post

Thank you so much for your help and detailed explanations! I just wanted to point out that one detail was missing, the solution didn’t show items without data, which was important for my scenario. Still, your guidance was extremely helpful, and thanks to your answers, I was able to solve my problem. I really appreciate your support!

View solution in original post

7 REPLIES 7
MarkLaf
Memorable Member
Memorable Member

Probably the most straightforward way, but somewhat of a blunt instrument, is to turn on "Show items with no data". Just right-click on any non-measure field in the field well and select.

 

Quick example:

 

Table

 

FieldSub FieldField Value
AX10
BX20
CX30
DX40
AY50
BY60

 

Measure

 

Blank Non A = CALCULATE( SUM( 'Table'[Field Value] ), KEEPFILTERS( 'Table'[Field] = "A" ) )

 

Switching on "Show items with no data"

 

MarkLaf_0-1748385207962.gif

 

 

Thank you for your reply!

 

Turning on "Show items with no data" is helpful for displaying all months in the visual, but in my case, I need a solution based on a measure. I intend to use this measure for additional logic, such as marking "XXXX" for months after the selected value in the slicer.

 

I've attached a sample file to better illustrate my scenario.

 

If you have any DAX-based approaches for this kind of dynamic comparison and signaling, I would really appreciate it!

 

Thanks again!

Got it. With your current model, there is no way to have a slicer affect a measure in a visual without also affecting the overall filter on the visual. In case you thought of maybe addressing this with "Edit interactions," telling the slicer to not impact your visual will also stop the slicer from impacting the measure inside the visual.

 

So, to achieve what you want, you need to update your model with another calendar dimension table that is not related to your fact table. You can then use a measure with a virtual relationship between the disconnected calendar dimension and your fact table.

 

New Model

Quick notes:

1) I switched your relationship between your calendar dimension and fact to 1:* rather than *:*

2) I set a 1:* relationship from our original calendar to the disconnected calendar, so Dcalendar will filter Dcalendar_Selector, but not other way around

 

MarkLaf_2-1748491320476.png

 

The new table to create:

Dcalender_Selector = Dcalender

 

New Slicer

 

MarkLaf_5-1748492412581.png

 

Measure

 

Selector Calc = 
IF(
    CALCULATE( 
        NOT ISEMPTY( 'Table' ), 
        TREATAS( VALUES( Dcalender_Selector[Date] ), 'Table'[Data] ), 
        'Table' 
    ),
    "XXXXX" 
)

 

Now you can see the disconnected will impact the measure without impacting the visual, unlike the original slicer

 

MarkLaf_4-1748492233631.gif

 

 

@MarkLaf Hi! I was able to highlight the row corresponding to the value selected in the slicer in the table, following your guidance. Now, I’d like to know how I can make the value selected in the slicer appear in all rows of the table, that is, show the same value for every month. Could you help me with this? Thank you!

Do you just want the value selected in the slicer to be used in the measure?

 

Or do you want the whatever "XXXXX" is to be repeated? It wasn't super clear what you were doing in the measure given we were just working with string "XXXXX" but I assume that "XXXXX" was stand-in for some kind of calculation?

 

This may need tweaking depending on what you are doing with "XXXXX", but this works with a simple calc like SUM, which I used for testing:

Selector Calc All Rows = 
VAR _slicerSelect = 
CALCULATETABLE( 
    VALUES( Dcalender_Selector[Date] ), 
    REMOVEFILTERS( Dcalender ) 
)
RETURN
IF(
    NOT ISEMPTY( 'Table' ),
    CALCULATE( 
        SUM( 'Table'[VALOR] ), // <--- whatever your "XXXXX" calc is goes here
        TREATAS( _slicerSelect, 'Table'[Data] ),
        REMOVEFILTERS( 'Table' )
    )
)

 

Thank you so much for your help and detailed explanations! I just wanted to point out that one detail was missing, the solution didn’t show items without data, which was important for my scenario. Still, your guidance was extremely helpful, and thanks to your answers, I was able to solve my problem. I really appreciate your support!

Arash_Bhz
Frequent Visitor

Hi, use a selectedvalue in a calculated measure to mark it as needed, here is the dax:
Marker =
VAR SelectedMonth = SELECTEDVALUE('DateTable'[MonthNumber])
VAR SelectedYear = SELECTEDVALUE('DateTable'[Year])
VAR CurrentMonth = MONTH(MAX('DateTable'[Date]))
VAR CurrentYear = YEAR(MAX('DateTable'[Date]))
RETURN
IF(
SelectedMonth = CurrentMonth &&
SelectedYear = CurrentYear,
"XXXXX",
BLANK()
)


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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