Forum Discussion

Txtcher's avatar
Txtcher
Helper V
11 months ago
Solved

Field Parameters And Visuals

I am preparing a report that counts backlogged complaints.

This is the schema.

They want the complaints (RS Case) counts by 3 different categories:  RS Cases[Region], RS Cases[Program] & RS Cases[Priority]. I created a parameter called _LTCR_Dimension_Par:

_LTCR_Dimension_par = {
     ("Region", NAMEOF('RS Cases'[Region]), 0),
    ("Program", NAMEOF('RS Cases'[Program]), 1),
    ("Priority", NAMEOF('RS Cases'[Priority]), 2)
}

I have also created measures for the different types of case counts. I put these measures in an Insight parameter.

_LTCR_Insights_par = {
    ("Current Month Backlog", NAMEOF('Measure'[Backlog]), 0),
    ("Backlog Intakes Closed This Month", NAMEOF('Measure'[Backlog Intakes Closed]), 1),
    ("Current Month LOF Backlog", NAMEOF('Measure'[LOF_Backlog Insight]), 2),
    ("LOF Backlog Intakes Closed This Month", NAMEOF([LOF_Backlog Closed Insight]), 3),
    ("Current ANE Backlog", NAMEOF('Measure'[ANE Backlog]), 4),
    ("ANE Backlog Intakes Closed This Month", NAMEOF('Measure'[ANE Backlog Intakes Closed]), 5)
}

I am using these 2 parameters in this visual:

The button slicer (below the card visual in the upper left) uses the _LTCR Insights_par parameter.

The slicer beneath with the radio buttons is the _LTCR_Dimenions_par.

This all works great. Click on the button, and all the visuals change as expected. However, I have one issue I can't resolve.

There is a measure in the Insights parameter that counts complaints for a select set of Programs (one of the dimensions). 

LOF Backlog = 
CALCULATE([Backlog], 'RS Cases'[Program] in {"Assisted Living", "DAHS", "DAHS-ISS", "DAHS-ISSONLY"}
)

I ran into an issue with this measure if the user selected it (Current Month LOF Backlog) and the Program filter: The bar chart displayed the total count for each program and not the individual count.  I fixed that issue by creating a 2nd measure:

LOF Backlog by Program = 
VAR SelectedProgram = SELECTEDVALUE('RS Cases'[Program])
RETURN
IF(
SelectedProgram IN {"Assisted Living", "DAHS", "DAHS-ISS", "DAHS-ISSONLY"},
CALCULATE([Backlog], 'RS Cases'[Program] = SelectedProgram),
0
)

Then I created a 3rd measure that replaced the orginial measure in the Insight parameter. This measure checks to see what selections the user has made. If user selected LOF Insight and Program from the Dimension parameter, then it uses the LOF Backlog by Program measure.

The bar charts work perfectly now.

LOF_Backlog Insight = 
VAR SelectedParameter = SELECTEDVALUE(_LTCR_Dimension_par[Reg-Prog-Priority_par Order])
Var SelectedInsight = SELECTEDVALUE(_LTCR_Insights_par[_LTCR_Insights_par Order])
//Determine if the parameter value selected if LOF Insight and Program dimension
RETURN
SWITCH(
    TRUE(),
    SelectedParameter = 1 && SelectedInsight = 2,[LOF Backlog by Program],
    [LOF Backlog]
)

But, now the card visual in the upper left is not working when the user selects the LOF Insight, and the Program dimension, it displays 0.

In layman's terms I know it is giving me a zero because the card visual doesn't know what programs are selected. 
I am not sure if there is a way to fix this problem. I am not even sure I have described it correctly.
Sample Data:

RS Case NoRegionProgramPriority
011101DAHSFacility 18-day
011306NursingFacility 30-day
011508Assisted LivingFacility 18-day
011703DAHS-ISSFacility 14-day
011902NursingFacility 24 hour
012105Assisted LivingFacility 14-day
012307DAHSFacility 18-day
012503NursingFacility 14-day
012709Assisted LivingFacility 14-day

 

With the data above, if the user selected Current Month LOF Backlog from the button slicer and any of the slicer selections for Region, Program or Priority, the card visual should display 6. 

Thank you in advance.

  • Anonymous's avatar
    Anonymous
    11 months ago

    Hi Txtcher ,

    Thanks lbendlin for the follow-up and for explaining everything so clearly.

    You’re absolutely right the card is giving you 0 because it doesn’t have a specific program in context the way your bar chart does. The fix is to let the measure fall back to the overall LOF backlog whenever there isn’t exactly one program in play. That way your bar chart still works, but your card will also show the right total.

    You can adjust your measure in bellow way.

    LOF_Backlog Insight =
    VAR SelectedParameter = SELECTEDVALUE(_LTCR_Dimension_par[Reg-Prog-Priority_par Order])
    VAR SelectedInsight   = SELECTEDVALUE(_LTCR_Insights_par[_LTCR_Insights_par Order])
    VAR ProgramFilter     = HASONEVALUE('RS Cases'[Program])
    RETURN
    SWITCH(TRUE(), SelectedParameter = 1 && SelectedInsight = 2 && ProgramFilter, [LOF Backlog by Program],SelectedInsight = 2, [LOF Backlog],[Backlog]) 

    Now you can achieve

    • Your bar chart will split LOF backlog correctly by each Program.
    • Your card will show the total (6 in your sample) when “Current Month LOF Backlog” is picked, even though you also selected Program in the dimension parameter.

    Just let you know that, don’t rely only on the parameter, also check whether a single Program is actually in context. If not, show the total.

    This small tweak should make both the card and the bar chart behave exactly the way you described. If you still face any issues, please share sample data are PBIX if there is no senstive data. Happy to help you.


    Thanks,
    Akhil.

     

3 Replies

  • Field Parameters happen "before" Visual Calculations.  Visual Calculations have no idea where the data came from that they are acting upon.  You would have to drop the idea of visual calculations and use measures instead. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Txtcher ,

    Thanks lbendlin for the follow-up and for explaining everything so clearly.

    You’re absolutely right the card is giving you 0 because it doesn’t have a specific program in context the way your bar chart does. The fix is to let the measure fall back to the overall LOF backlog whenever there isn’t exactly one program in play. That way your bar chart still works, but your card will also show the right total.

    You can adjust your measure in bellow way.

    LOF_Backlog Insight =
    VAR SelectedParameter = SELECTEDVALUE(_LTCR_Dimension_par[Reg-Prog-Priority_par Order])
    VAR SelectedInsight   = SELECTEDVALUE(_LTCR_Insights_par[_LTCR_Insights_par Order])
    VAR ProgramFilter     = HASONEVALUE('RS Cases'[Program])
    RETURN
    SWITCH(TRUE(), SelectedParameter = 1 && SelectedInsight = 2 && ProgramFilter, [LOF Backlog by Program],SelectedInsight = 2, [LOF Backlog],[Backlog]) 

    Now you can achieve

    • Your bar chart will split LOF backlog correctly by each Program.
    • Your card will show the total (6 in your sample) when “Current Month LOF Backlog” is picked, even though you also selected Program in the dimension parameter.

    Just let you know that, don’t rely only on the parameter, also check whether a single Program is actually in context. If not, show the total.

    This small tweak should make both the card and the bar chart behave exactly the way you described. If you still face any issues, please share sample data are PBIX if there is no senstive data. Happy to help you.


    Thanks,
    Akhil.

     

    • Txtcher's avatar
      Txtcher
      Helper V

      Anonymous , Many, many thanks to you. This has fixed the issue and I am so very grateful to you for taking the time to respond. 

      I did understand the card visual was giving me a 0 because it lacked context but could not come up with a way to solve the problem. Your solution works beautifully. 
      Again, thank you. I have learned so much here in this forum. It has been invaluable to me.