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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
jbaynhamUK
Regular Visitor

Cross highlight seems to remove affect of ALL

I have a Dates table, which includes a Season column. Seasons run from August 1 to July 31. As part of a more complex measure, I need to know the last selected date in the date slicer. The measure is run per season, so to get this date I am using

 

 

 

MaxSelectedDate =
    CALCULATE ( MAX ( Dates[Date] ), ALL( Dates[Season] ) )

 

 

 

This works fine, if the slicer date range is set to end at 31 May 22, the measure returns this date for all seasons. However, the visual featuring the measure can be cross-highlighted by another season-based visual. If you choose say, the 2018/19 season, the measure calcs as 31 July 19, the max date for the chosen season. It seems to ignore the ALL( Dates[Season] ) filter removal. How can I stop it doing this? The DAX query being run is:

 

 

DEFINE
  VAR __DS0FilterTable = 
    FILTER(
      KEEPFILTERS(VALUES('Dates'[Date])),
      'Dates'[Date] < DATE(2022, 6, 1)
    )

  VAR __DS0FilterTable2 = 
    TREATAS({"2018/19"}, 'Dates'[Season])

  VAR __DS0Core = 
    SUMMARIZECOLUMNS(
      ROLLUPADDISSUBTOTAL('Dates'[Season], "IsGrandTotalRowTotal"),
      __DS0FilterTable,
      __DS0FilterTable2,
      "Measure_2", CALCULATE ( MAX ( Dates[Date] ), ALL(Dates[Season]))
    )

  VAR __DS0PrimaryWindowed = 
    TOPN(502, __DS0Core, [IsGrandTotalRowTotal], 0, 'Dates'[Season], 1)

EVALUATE
  __DS0PrimaryWindowed

ORDER BY
  [IsGrandTotalRowTotal] DESC, 'Dates'[Season]

 

 

 

 

 

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @jbaynhamUK 

Thanks for reaching out to us.

>>  As part of a more complex measure, I need to know the last selected date in the date slicer.

you can use  date=maxx(allselected('date'),[date])  to get the last selected date in the date slicer.

 

>> f you choose say, the 2018/19 season, the measure calcs as 31 July 19, the max date for the chosen season. It seems to ignore the ALL( Dates[Season] ) filter removal. 

The fact is that when you select in Season, it also affects the range of the date table, so when two filters on the date table happen together, they cannot be distinguished, measure will only return the largest date after the two filters. 

vxiaotang_0-1657268748657.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-xiaotang
Community Support
Community Support

Hi @jbaynhamUK 

Thanks for reaching out to us.

>>  As part of a more complex measure, I need to know the last selected date in the date slicer.

you can use  date=maxx(allselected('date'),[date])  to get the last selected date in the date slicer.

 

>> f you choose say, the 2018/19 season, the measure calcs as 31 July 19, the max date for the chosen season. It seems to ignore the ALL( Dates[Season] ) filter removal. 

The fact is that when you select in Season, it also affects the range of the date table, so when two filters on the date table happen together, they cannot be distinguished, measure will only return the largest date after the two filters. 

vxiaotang_0-1657268748657.png

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Thanks for this. I understand what you are saying, but it does seem crazy that the inbuilt cross filtering/highlighting functionality is able to sabotage the operation of measures in this way, with no way of writing them to protect against it.

 

jbaynhamUK
Regular Visitor

Thanks for your reply. I have tried with ALLSELECTED, but the measure still returns the last date in the season, not the last date in the slicer.

 

I have created a minimal example here

If you pick a date in the slicer the last date shows against every season in the right-hand table. Choose a season in the left-hand table to cross filter the right-hand table, and it changes to the last date in that season.

 

amitchandak
Super User
Super User

@jbaynhamUK , for max selected you should use allselected

 

MaxSelectedDate =
CALCULATE ( MAX ( Dates[Date] ), ALLselected( Dates[Season] ) )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

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.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.