Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Highlight/filter a visual from two other visuals

I have a situation where I have two line charts and one bar chart. 

First line chart shows the count by months and second by days for the last month only. 

Bar chart splits the count further down by a group. 

What I would wanna do is have the bar chart to display count by month when a selection is made in the left line chart or by day if a selection is made in the right line chart.

 

I have created Date bins by Days and another by months and in my measure I have the following code.

 

Count of Errors Selected =
var CurrentMonthMonday = CALCULATE(
SUM(MonthlyErrors[Errorcount]),
FILTER(Calendar,Calendar[LatestBillingWeek]=TRUE() && Calendar[IsFirstDayofWeek]=TRUE()))
return
IF(not HASONEVALUE(MonthlyErrors[Date (bins) Months]) || not HASONEVALUE(MonthlyErrors[Date (bins) Days]), CurrentMonthMonday,
IF(HASONEVALUE(MonthlyErrors[Date (bins) Days]),[Count of Errors Days],
IF(HASONEVALUE(MonthlyErrors[Date (bins) Months]),[Count of Errors Months],CurrentMonthMonday)))
 
I think the problem with this code is that because 'Date (bins) Days' comes first in the if statement it highlights bar chart for it but not when a month selection is made on the left line chart. 
 
What am i doing wrong?

 

 

  • Hi Anonymous ,

     

    Try the following formula:

     

    Count of Errors Selected = 
    var CurrentMonthMonday = 
    CALCULATE(
        SUM(MonthlyErrors[Errorcount]),
        FILTER('Calendar',Calendar[LatestBillingWeek]=TRUE() && Calendar[IsFirstDayofWeek]=TRUE())
    )
    return
    IF(
        not HASONEVALUE(MonthlyErrors[Date (bins) Months]) || not HASONEVALUE(MonthlyErrors[Date (bins) Days]), 
        CurrentMonthMonday,
        IF(
            HASONEVALUE(MonthlyErrors[Date (bins) Days]) && MAX(MonthlyErrors[Date (bins) Days]) <> "Other",
            [Count of Errors Days],
            [Count of Errors Months]
        )
    )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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

1 Reply

  • v-kkf-msft's avatar
    v-kkf-msft
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    Try the following formula:

     

    Count of Errors Selected = 
    var CurrentMonthMonday = 
    CALCULATE(
        SUM(MonthlyErrors[Errorcount]),
        FILTER('Calendar',Calendar[LatestBillingWeek]=TRUE() && Calendar[IsFirstDayofWeek]=TRUE())
    )
    return
    IF(
        not HASONEVALUE(MonthlyErrors[Date (bins) Months]) || not HASONEVALUE(MonthlyErrors[Date (bins) Days]), 
        CurrentMonthMonday,
        IF(
            HASONEVALUE(MonthlyErrors[Date (bins) Days]) && MAX(MonthlyErrors[Date (bins) Days]) <> "Other",
            [Count of Errors Days],
            [Count of Errors Months]
        )
    )

     

    If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

    Best Regards,
    Winniz

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