Forum Discussion
Visual Title - Measure Doesn't Filter on Filter Selection
- Anonymous2 years ago
HI OwenAuger ,
Thanks for looking at this. It's frustrating that Power BI doesn't allow something so simple as this.
I think, to keep things simple, I'm going to group a card and filter together with the title in the card and use that. This will mean I don't need to add more rows into my data.
I really appreciate you taking the time to try figure this out for me.
Thanks,Mark
Interesting 🙂
Not sure which visual that would have been, but would be interesting if you can find it again.
Certain custom visuals (Hierarchy Slicer and Preselected Slicer for instance) display some text indicating which (or how many) selections have been made, but this can't be customized using a measure, as this is part of the custom visual's logic rather than being evaluated by querying the model.
It's discussed here on this Issues page as well.
So I really can't see any any visual's Title can respond to its own selections by means of evaluating a measure.
Regardless of how the DAX expression is crafted, the Title measure is evaluated in a context where the filters from the slicer itself don't exist.
If you can find the example you're talking about that would be great, otherwise someone else may have some suggestions.
Regards
I had another look, and the best I can come up is a bit of a hack using a "hidden" Preselected Slicer custom visual.
Here's what I tried (PBIX attached):
1. Create an additional disconnected table called something like Campaign, with a single column campaign_id containing all distinct values of campaign_id.
2. Create a table Dummy, with a single column Dummy with two rows (true & false). This needs to be placed in the Preselected Slicer's "Dirty Status" field well.
3. Create/modify the measures (shown below):
Total Campaign IDs =
DISTINCTCOUNT ( Campaign[campaign_id] )Filter Title: Full Campaign with Count =
"Full Campaign Name & ID: "
& IF (
[Total Campaign IDs] = 1,
[Total Campaign IDs] & " Campaign",
IF (
ISBLANK ( [Total Campaign IDs] ),
"0 Campaigns",
[Total Campaign IDs] & " Campaigns"
)
)Preselected Slicer Filter =
SELECTEDVALUE ( Campaign[campaign_id] ) IN VALUES ( '04a: Ads (fact)'[campaign_id] )
4. Set up the Preselected Slicer as shown:
5. Ensure the Preselected Slicer is in a "reset" state (click reset button on Header).
6. "Hide" the Preselected Slicer by reducing its size and placing it somewhere inconspicuous, such as behind the main slicer. Hiding the visual unfortunately won't work.
7. Set the main slicer title measure to Filter Title: Full Campaign with Count.
8. Now the slicer's title updates as expected:
It's more complicated than I would like for such a simple requirement, but it works I guess.
It seems that we need to use such a method because Power BI refuses to apply filters to the slicer's title measure if they depend on the field used in the slicer (by relationships or DAX expressions). However the filter from the Preselected Slicer appears to break this lineage 🙂
Would this be a workable method? Would be interested in simpler solutions. 😅
Regards,
Owen
- Anonymous2 years agoNot applicable
HI OwenAuger ,
Thanks for looking at this. It's frustrating that Power BI doesn't allow something so simple as this.
I think, to keep things simple, I'm going to group a card and filter together with the title in the card and use that. This will mean I don't need to add more rows into my data.
I really appreciate you taking the time to try figure this out for me.
Thanks,Mark