Forum Discussion

Lakhani04's avatar
Lakhani04
Frequent Visitor
1 year ago
Solved

Assistance Required - Power BI Visual Matrix

Hello Everyone,

I hope you're doing well.

I have a quick query regarding a Power BI matrix visualization. I’m trying to create a table with the following setup:

  • Rows: Assignment Group
  • Columns: Year and Month
  • Values: SLA %

The challenge I'm facing is with adding a “SLA % 3M” measure. When I add it to the matrix, it appears under every month. However, I need this as a standalone column, completely independent of the month/year column slicers.

I’ve already tried using DAX functions like REMOVEFILTER, ALL, and ALLSELECTED, but haven’t had success.

Has anyone implemented something similar or can suggest a solution? I'd really appreciate any help or guidance. Please feel free to ping me if you have any suggestions.

Thank you in advance!

Sample Table

Assignment Group2025-042025-05...SLA% 3M
Group A0.870.92...0.89
     
Group B............

 



  • antfr99's avatar
    antfr99
    1 year ago

    Hi Tejas

     

    Ok, great to hear that there is some progress. I took another look to see if I could get rid of the empty columns . I could only find a solution in Power Query and this was the result : 

     

     

     

     

    In general the steps taken are as follows :  Identifies the Maxmonth and two months before ( Query : MaxMonthQuery  ) , which joins with the Grouped average per assignment group ( Query : GroupedAverageQuery ) . This then finally joins with the MaindataQuery ( filtered to show only 3 months prior to max date of the data ) to merge the average SLA% per group.

     

    For the updated file see the same folder I placed the other Power BI files in. 

     

    Hope this helps

    Antonio 

     

     

12 Replies

  • I want to help you but your description is too vague. Please write it again.

    The example data you provide is too small. 

    Please provide example input data and the desired output.
    You spents more effort saying you tried REMOVEFILTER, ALL, and ALLSELECTED rather than explaining the requirments. 😀😀😀


    You will get a quicker and better response without misunderstandings if you put time and effort into carefully writing a clear problem description with example input and output data. Look forward to helping you when this information is forthcoming


    * Please DON'T copy & paste your DAX that does not work and expect us to fathom what you want. (That is just crazy). ‌‌ 😀😀😀
    * Please DO give a simple non-technical functional description of what you want
    * Keep it simple and break large projects into smaller questions and ask just one question per ticket.
    * Rename columns to user friendly names. Avoid your own system jargon that we may not understand.
    * Most importantly please provide example input data as table text (not a screen print) so helpers can import the data to build a solution for you. (Learn how to share data below)
    * Provide the example desired output, with a clear step-by-step description of calculations and the process flow.
    * Take time and care to use the same table and field names in the input, output and description so we can understand your problem and help you.
    * Remove any unneeded tables, rows or columns which may cause confusion. Keep it short and concise with the minimal information regarding the key problem.
    * Remember not to share private data ... we don't want you to get into trouble. ‌‌
    * Please click the thumbs up button for these helpful hints and tips. Thank you.


    Learn how to attach data in the forum using OneDrive:-
    * Save your file in a OneDrive folder
    * Right click on the file and click the “Share” blue cloud icon
    * Click the bottom “Copy” button
    * Click” Anyone with link can edit”
    * Click “Can Edit”
    * Click “Can View”
    * Click “Apply” button
    * Click “Copy”
    * Paste the generated link via the forum, email, chat, or any other method.
    * Helpers can then download your data, build a solution and share it back.


    Learn how to attach data in the forum using Dropbox:-
    1. Open Dropbox: Access the Dropbox folder on your computer or through the Dropbox web interface.
    2. Select File/Folder: Find the file or folder you want to share.
    3. Click Share (or Get Link): Look for a "Share" option or a similar "Get Link" option.
    4. Choose Permissions: Decide whether to allow "view only" or "view and download" access.
    5. Copy and Share: Copy the generated link and share it with anyone via the forum, email, chat, or any other method.

     

     

  • To solve this challenge in Power BI Matrix where:

    • Rows: Assignment Group
    • Columns: Year-Month (e.g., "2025-04", "2025-05")
    • Values: SLA %
    • Extra Column: SLA% 3M (should show as a separate column, not repeat under each month)

    We need to display a static column (SLA% 3M) in the matrix, unaffected by the column grouping (Month-Year), which Power BI matrix doesn’t directly support by default. However, here's how we can solve it with a workaround.

     

    Solution:

    1. Create a New Table for Matrix Columns
      We’ll use a disconnected table to define the columns we want in the matrix.
      "Matrix Columns =
      DATATABLE("ColumnLabel", STRING, {
      {"Monthly SLA%"},
      {"SLA% 3M"}
      })
      "

    2. Create a Measure to Return SLA Values Conditionally
      Now write a measure that handles both monthly SLA and the 3-month SLA logic:

      "SLA % Matrix Display =
      SWITCH(
      SELECTEDVALUE('Matrix Columns'[ColumnLabel]),

      "Monthly SLA%",
      CALCULATE(
      [SLA %],
      REMOVEFILTERS('Matrix Columns')
      ),

      "SLA% 3M",
      CALCULATE(
      [SLA % 3M],
      REMOVEFILTERS('Date'), // or 'Calendar'[YearMonth], depending on your model
      REMOVEFILTERS('Matrix Columns')
      )
      )
      "

    3. Create the Matrix Visual
      Use the following fields:
    • Rows: Assignment Group
    • Columns: Matrix Columns[ColumnLabel]
    • Values: SLA % Matrix Display

    The problem arises because you're trying to show a measure independent of the column slicer, but the Power BI matrix groups values based on the column hierarchy.

    By creating a custom column header table, and conditionally calculating measures using SELECTEDVALUE, you bypass this behavior and control what appears under each column.

     

    If [SLA % 3M] isn't defined yet, here’s an example of how you can write one:

     

     

     

    "SLA % 3M =
    CALCULATE(
    AVERAGE('YourTable'[SLA %]),
    DATESINPERIOD('Date'[Date], MAX('Date'[Date]), -3, MONTH)
    )
    "

     

    Modify logic based on your business rules.

     

    If this solution works for you, please consider accepting it as the solution and giving it a kudos — it helps others find the answer more easily and supports the community.

  • Hi Lakhani04 

     

    I suggest the following : 

    SLA % 3M = 
    VAR MaxDate =
        CALCULATE(
            MAX(Data[Date]),
            REMOVEFILTERS(Data) 
        )
    VAR Last3Months =
        DATESINPERIOD(
            Data[Date],
            MaxDate,
            -3,
            MONTH
        )
    RETURN
        CALCULATE(
            AVERAGE(Data[SLA %]),
            FILTER(
                ALL(Data),  
                Data[Date] IN Last3Months &&
                Data[Assignment Group] = MAX(Data[Assignment Group])
            )
        )

     

     

    Result tested with slicer ( table with percentages not affected by slicer - for previous 3 months > as per max date of the data ) : 

     

     

    Below is some further information so that you can adjust the measure if required : 

     

    -MaxDate gets the latest date from the entire table, ignoring any filters (like slicers).

     

    -Last3Months creates a list of dates from the last 3 months up to that MaxDate.

     

    -RETURN calculates the average SLA % only for rows in those 3 months and only for the currently selected assignment group.

     

    Hope this helps

    Antonio 

     

      • antfr99's avatar
        antfr99
        Resolver II

        Hi Lakhani04 

         

        Below is another possible solution without Removefilters : 

         

        SLA % Last 3M = 
        VAR MaxDate =
            CALCULATE(
                MAX(Data[Date]),
                ALL(Data)
            )
        VAR Last3Months =
            DATESINPERIOD(
                'Data'[Date],
                MaxDate,
                -3,
                MONTH
            )
        RETURN
            CALCULATE(
                AVERAGE('Data'[SLA %]),
                Last3Months,
                ALLEXCEPT('Data', 'Data'[Assignment Group])
            )

         

        with the below result : 

         

         

        Below is my Power BI file if required , feel free to test with a sample of your data.

         

        Power BI Community 25 July 2025

         

        If this amendment does not work , please povide further details ( error message, extra screenshots or a sample file ) .

         

        Antonio

  • Lakhani04  Hey,
    I will create below measure . I am assume that you these measure SLA met and total case as measure based on that SLA % 3months is getting calculated.

     

    SLA % Last 3 Months =
    VAR MaxDateInModel = CALCULATE(MAX('Date'[Date]), ALL('Date'))
    VAR StartDate = EDATE(MaxDateInModel, -2) -- last 3 months: includes current month and previous 2 months

    // Filter for last 3 months ignoring slicers on Month and Year
    VAR Last3MonthsDates =
    FILTER(
    ALL('Date'),
    'Date'[Date] >= StartDate
    && 'Date'[Date] <= MaxDateInModel
    )

    // Calculate sums within last 3 months, ignoring month/year slicers but respecting row context (grouping)
    VAR MetSLA3M =
    CALCULATE(
    SUM('SLAData'[Met SLA]),
    KEEPFILTERS(Last3MonthsDates)
    )

    VAR TotalCases3M =
    CALCULATE(
    SUM('SLAData'[Total Cases]),
    KEEPFILTERS(Last3MonthsDates)
    )

    RETURN
    DIVIDE(MetSLA3M, TotalCases3M, 0)

     

    Thanks

    Harish M 

    Kindly give kudos and accepts it as solution as if its resolve your problem