Forum Discussion

nxr3kor's avatar
nxr3kor
New Member
5 months ago

Showing Blank and Selected Phase Rows in Matrix Based on Phase Slicer Selection

 

Hello Power BI Community,

I am working on a Process Results Analysis report in Power BI. I have a matrix visual with the following hierarchy:

 

Plant, Machine Name, Order, Material, Serial, Timestamp, Release Type, Process, Phase, Parameter, Value, Target, Limits, Result

 

I also have slicers for Process, Phase, Parameter, etc.

 

Scenario:

When I select a specific Process (e.g., 10601000.00) and a specific Phase in the slicer (e.g., DR-Hysterese), I want the matrix to show:

 

The selected phase (DR-Hysterese) with its respective parameter rows.

 

Currently, the matrix only shows the selected phase, and the blank row does not appear.

 

My question:

Is it possible in Power BI to have the matrix visual always include a blank phase row along with the selected phase when using slicers? If yes, what is the best approach (DAX or modeling) to achieve this behavior?

 

If phase is filtered, all records where PHASE_NAME matches the filtered value, including their children (i.e. parameters) and parents (i.e processes), shall be loaded.

 

 

 

If parameter is filtered, all records where PARAMETER_NAME matches the filtered value, including their parents (i.e. processes and phases), shall be loaded.

 

 

if you have updates please reach out me. Thanks

 

 

 

7 Replies

  • hey, nxr3kor ,

    you can do something like this:

    Have a slicer for phases, for example, as a different table, then write measure like this:

    filter measure = 
    var selectedValues = VALUES(dim_phases[name])
    
    var result = 
    CALCULATE(
        COUNTROWS(tbl),
        KEEPFILTERS(
            OR(
                tbl[Phase] IN selectedValues,
                tbl[Phase] = "" 
            )
        )
    )
    
    return result

     

    This basically counts rows of the fact table with your data, but feel free to use any calculation you require, but this use case works well as filter measure.

     

    Then in the visual you want have impacted by this, add the new measure as Filter on visual and set it as 'is not blank'.

     

    And that's it, now you'll also always see the empty (if it's blank and not empty, modify the second condition) values with the desired phase filtered.

     

    Also attaching the whole solution.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nxr3kor 

    Thank you for reaching out to the Microsoft Fabric Forum Community.

    vojtechsima Thanks for the inputs.

    I hope the information provided by user was helpful. If you still have questions, please don't hesitate to reach out to the community.

     

    • nxr3kor's avatar
      nxr3kor
      New Member

      Hello Anonymous vojtechsima , 

      Thanks for your reply. However, the result you provided is not what I expected.

      I have described the requirement below for clarity:

      Currently, when I filter from parent → child (Process → Phase → Parameter), the matrix correctly shows the ENTITY_TYPE for each level based on the DAX I have implemented.

      What I need is for the same behavior to work when filtering from child → parent (Parameter → Phase → Process). In other words, the matrix should dynamically display the correct ENTITY_TYPE regardless of the filter direction.



      step1: follow below image

      step2: follow below image

      step3: Please follow below image 

       

      step 4: when i filters  from chaildlevel to parameter level i can not see the entity type phase level value

      Below are the DAX I am using for both the matrix visual and (Phase and Parameter slicers):
      DAX1: This dax i have used for Phase and parameter Slicers:

      Process Overview Slicer =
      VAR T =
          SELECTCOLUMNS (
              Fac_Process_Overview,
              "Phase",     Fac_Process_Overview[PHASE_NAME],
              "Parameter", Fac_Process_Overview[PARAMETER_NAME],
              "Material",  Fac_Process_Overview[MATERIAL_NUMBER]
          )
      RETURN
      DISTINCT (
          UNION (
              T,
              ROW ( "Phase", BLANK(), "Parameter", BLANK(), "Material", BLANK() )
          )
      )

      DAX2: This dax i have used for Matrix visual:

      Process Overview Matrix =
      VAR _curProcess =
          SELECTEDVALUE ( Fac_Process_Overview[PROCESS_NAME] )

      VAR _curPhase =
          SELECTEDVALUE ( Fac_Process_Overview[PHASE_NAME] )

      VAR _curParam =
          SELECTEDVALUE ( Fac_Process_Overview[PARAMETER_NAME] )

      -- Disconnected slicer selections
      VAR _selPhase =
          FILTER (
              VALUES ( 'Process Overview Slicer'[Phase] ),
              NOT ISBLANK ( 'Process Overview Slicer'[Phase] )
          )

      VAR _selParam =
          FILTER (
              VALUES ( 'Process Overview Slicer'[Parameter] ),
              NOT ISBLANK ( 'Process Overview Slicer'[Parameter] )
          )

      VAR _isPhaseFiltered =
          ISFILTERED ( 'Process Overview Slicer'[Phase] )

      VAR _isParamFiltered =
          ISFILTERED ( 'Process Overview Slicer'[Parameter] )

      /* Reverse cascade logic:
         If Parameter slicer is selected and Phase slicer is ALL,
         then only show phases that actually contain the selected parameter(s)
         in current report context (plant/machine/material/serial/process etc.)
      */
      VAR _validPhasesFromParam =
          CALCULATETABLE (
              VALUES ( Fac_Process_Overview[PHASE_NAME] ),
              TREATAS ( _selParam, Fac_Process_Overview[PARAMETER_NAME] )
          )

      VAR _phaseAllowed =
          // Case-1: Phase slicer is used -> respect it (plus keep blank phase rows)
          IF (
              _isPhaseFiltered,
              ( _curPhase IN _selPhase ) || ISBLANK ( _curPhase ),
              // Case-2: Phase slicer is NOT used
              // If parameter is selected -> allow only phases that have that parameter (plus blanks)
              IF (
                  _isParamFiltered,
                  ( _curPhase IN _validPhasesFromParam ) || ISBLANK ( _curPhase ),
                  // No phase filter and no parameter filter -> allow all phases
                  TRUE ()
              )
          )

      VAR _paramAllowed =
          IF (
              _isParamFiltered,
              ( _curParam IN _selParam ) || ISBLANK ( _curParam ),
              TRUE ()
          )

      RETURN
      IF (
          NOT ISBLANK ( _curProcess )
              && _phaseAllowed
              && _paramAllowed,
          1,
          0
      )


      DAX3: 
      Show Phase in Slicer =
      VAR _phase = SELECTEDVALUE ( 'Process Overview Slicer'[Phase] )
      RETURN
      IF (
          ISBLANK ( _phase ),
          1,   -- always keep the BLANK row visible
          VAR _cnt =
              CALCULATE (
                  COUNTROWS ( Fac_Process_Overview ),
                  TREATAS ( { _phase }, Fac_Process_Overview[PHASE_NAME] )
              )
          RETURN IF ( _cnt > 0, 1, 0 )
      )

      DAX4:  
      Show Parameter in Slicer =
      VAR _param =
          SELECTEDVALUE ( 'Process Overview Slicer'[Parameter] )

      -- Selected Phase values (exclude blank)
      VAR _phaseSelNonBlank =
          FILTER (
              VALUES ( 'Process Overview Slicer'[Phase] ),
              NOT ISBLANK ( 'Process Overview Slicer'[Phase] )
          )

      -- When Phase slicer is NOT used
      VAR _cntNoPhase =
          CALCULATE (
              COUNTROWS ( Fac_Process_Overview ),
              TREATAS ( { _param }, Fac_Process_Overview[PARAMETER_NAME] )
          )

      -- When Phase slicer IS used (cascade)
      VAR _cntWithPhase =
          CALCULATE (
              COUNTROWS ( Fac_Process_Overview ),
              TREATAS ( { _param }, Fac_Process_Overview[PARAMETER_NAME] ),
              TREATAS ( _phaseSelNonBlank, Fac_Process_Overview[PHASE_NAME] )
          )

      VAR _cntFinal =
          IF (
              ISFILTERED ( 'Process Overview Slicer'[Phase] ),
              _cntWithPhase,
              _cntNoPhase
          )

      RETURN
      IF (
          ISBLANK ( _param ),
          1,  -- always show BLANK parameter row
          IF ( _cntFinal > 0, 1, 0 )
      )


      final expected result should be like this:

       

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nxr3kor 

    Thank you for reaching out to the Microsoft Fabric Forum Community.

    Please share the file & Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
    Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
    Please show the expected outcome based on the sample data you provided.

    Need help uploading data? 

    How to provide sample data in the Power BI Forum - Microsoft Fabric Community


    Thanks.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi nxr3kor 
      As i request earlier please share the sample data along with PBIX so we can work on it.
      Thanks.

      • nxr3kor's avatar
        nxr3kor
        New Member

        Hi Anonymous , vojtechsima 

        Thanks for Reaching me. I am providing you with sample images and expected results in below.
        Image 1:
        This represents the actual matrix visual without any slicer selection.

         

        Image 2:
        When I select the slicer Parameter = Param1, I expect to see:

        • The corresponding Process
        • The related Phases
        • Including process-level and phase-level blanks, since those blanks belong to the same process



         

        Image 3:
        When I select Phase = Phase2, I expect to see:

        • The corresponding Process
        • The related Parameters
        • Including relevant blanks, as they are associated with the same process

         

        Additional Requirements:

        1. KPI Count Logic:

        • KPI count should be based on entity_type = Process
        • When a user selects Phase or Parameter, the KPI count should not display as "0", because those Phase/Parameter values still belong to the same Process

        2. Slicer Behavior (Bidirectional Interaction):

        • Slicers for Process, Phase, and Parameter should interact with each other dynamically:
          • Selecting a Process → filters related Phase and Parameter
          • Selecting a Phase → filters related Process and Parameter
          • Selecting a Parameter → filters related Process and Phase

        3. Filtering Behavior:

        • Parent → Child filtering a nd 
        • Child → Parent filtering behavior should be see in images 

        Hint: 
        1. if process is filtered, all records where PROCESS_NAME matches the filtered value, including their children (i.e. phases and parameters and also blanks) shall be loaded.
        2. If phase is filtered, all records where PHASE_NAME matches the filtered value, including their children (i.e. parameters) and parents (i.e processes) including blanks, shall be loaded. 
        3. If parameter is filtered, all records where PARAMETER_NAME matches the filtered value, including their parents (i.e. processes and phases and also including blanks,), shall be loaded. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi

    Thanks for sharing the details. Would you please share a PBIX file, OneDrive link, or even a sample Excel file so we can try to reproduce your scenario?

    The images give a good idea of the expected output, but having the actual data/model would make it much easier to test and give you an accurate solution.

    Thanks.