Forum Discussion
Conditional Formatting within Tooltip
- 6 months ago
Hi,
Thanks for the help with this, its much appreciated.
Unfortunately, this isn't the behaviour I'm looking for as a solution, I need the Max & Min month name to be showing in the tooltip, preferably in its own column, your solution doesn't make it immediately obvious what months out of a possible 12 are the Max and Min.
I will close this ticket and re-open a new one.It maybe the fact that what I'm asking for is not even possible so it will be good to re-issue a new version of this ticket to see if that even possible.
Once again, thanks for all your help!
Hello ArchStanton ,
The main issue was that the tooltip was only evaluating the single hovered point instead of the full month range shown in the sparkline. To fix this, I rebuilt the example using a proper Calendar table linked to the cases data by date, and added a fiscal month number (Apr–Mar) so the months sort correctly. The tooltip measures then use ALLSELECTED to look across all months in the sparkline context, and TOPN to determine which month has the highest and lowest values, returning the month names instead of just the numbers.
I added the measures to a report tooltip page and linked it to the matrix. Now, when you hover over a row, the tooltip shows the actual months where the sparkline reaches its maximum and minimum, not just the values. Because the logic evaluates over the same month context as the sparkline, it works consistently even within the limited filter context of a tooltip.
Please find the attached PBIX and Screenshort file for your reference.
Best Regards,
Tejaswi.
Community Support
Hi,
I've tried your latest suggestion and unfortunately it didn't work - it has the same issue as the previous code you provided - it almost works and I prefer the look of this tooltip, could you please check if something can be done with this version first?
As you can see, its very close to working but my pbix file was last refreshed in January and so I have no data for Feb & Mar. Is there something that can be tweaked in the following DAX that ignores the future months of the current Fiscal Year?
MinMax Tooltip =
VAR AllTopics =
CALCULATETABLE (
ADDCOLUMNS ( VALUES ( 'Cases'[PrimaryTopic2] ), "Value", [Primary Topics] ),
ALLSELECTED ( 'Cases'[PrimaryTopic2] )
)
VAR NonBlankValues =
FILTER ( AllTopics, NOT ISBLANK ( [Value] ) )
VAR MinValue =
MINX ( NonBlankValues, [Value] )
VAR MaxValue =
MAXX ( NonBlankValues, [Value] )
VAR CurrentValue = [Primary Topics]
RETURN
SWITCH (
TRUE (),
CurrentValue = MinValue, "MIN",
CurrentValue = MaxValue, "MAX",
BLANK ()
)
- v-tejrama6 months agoCommunity Support
Hi ArchStanton ,
Power BI is picking the wrong 'minimum' month because blank (NULL) values are being treated like the smallest number. The solution is to adjust the measure so it ignores blanks first, then calculates the minimum only from rows that actually contain numbers, and finally returns the month linked to that real minimum. In short, filter out empty values before doing the MIN calculation, so 'no data' doesn’t get mistaken for the lowest data.
Thank you.- ArchStanton6 months agoPower Participant
Thanks, I'm confused because we already have a Variable called NonBlankValues which I thought would do this?
Anyway, my measure is a simple count:Primary Topic Count = COUNT('Cases'[PrimaryTopic2])I have another measure that I use to to count items in the current month which I've modified to use here but I still get the same issue.
ISINSCOPE New Topics = IF( ISINSCOPE(Date2[Mth]), -- Row Level (month) in scope so normal YTD logic TOTALYTD( COUNT('Cases'[PrimaryTopic2]), 'Cases'[Created On] ), -- Total level (month is not in scope so each visible mth is iterated) SUMX( VALUES(Date2[Mth]), TOTALYTD( COUNT('Cases'[PrimaryTopic2]), 'Cases'[Created On] ) ) )I still get the exact same results as before with MIN appearing in months in the future.
These NULLs are because the months are in the future so they are not INSCOPE?
I'm not sure how to fix this. - ArchStanton6 months agoPower Participant
Correct me if i'm wrong but its the fact that Feb & Mar are appearing that is causing this?
(This pbix file hasn't been refreshed since mid January).
I thought ISINSCOPE would Filter out future months?- v-tejrama6 months agoCommunity Support
Hi ArchStanton ,
This behavior is expected due to the way tooltips handle filter context. When a measure is calculated in a tooltip, it is evaluated only for the specific data point being hovered over, such as a single month. Consequently, the measure does not automatically access all months needed to determine minimum or maximum values. This is why the same DAX expression works in the matrix but not in the tooltip.
To resolve this, you need to explicitly expand the filter context within the measure, allowing evaluation across all relevant months while still respecting slicer selections. Using ALLSELECTED on the month field ensures visibility into the full range of values, and filtering out blanks prevents empty periods from being considered as the minimum. With these adjustments, min and max calculations will work consistently in both matrix and tooltip views.
Thank you.