Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.

Reply
reddevil
Helper II
Helper II

Table to be created using the below format

Hi Everyone:

I have created a single measure for Prev and Current quarter and want to split it in a matrix using the below format, can someone guide me how do i achieve the below matrix table using the prev and current quarter measure using switch.

 

CategoryMeasureDirectionprevcurrdiffprevcurrdiffprevcurrdiffprevcurrdiff
Risk Index↑↓            
Issues# Open Issues1020102116-5104737770
>= M Issues 23132-127510-1
Average Resolution Time (days)19421016000444289-155132122-10
>= M Issues 484400-8411270-42442429-13280-28
Overdue Issues33043-1187000
>= M Issues 00010-1132000
Incidents# Open Incidents1020102116-525447-207770
>= M Incidents 23132-14447-43710-1
Average Resolution Time (days)1942101600044289245132122-10
>= M Incidents 484400-8411270-4234742982280-28
Overdue Issues33043-1128-4000
>= M Incidents 00010-1033000
1 ACCEPTED SOLUTION
Akash_Varuna
Super User
Super User

Hi @reddevil Could you try this please create measures first for three seperatly and then do SWITCH statement in dax please check this 

  1. Create Measures:
    Define prev , curr , and diff measures:

    PrevMeasure = CALCULATE(SUM(Table[Value]), FILTER(Table, Table[Quarter] = "Previous"))  
    CurrMeasure = CALCULATE(SUM(Table[Value]), FILTER(Table, Table[Quarter] = "Current"))  
    DiffMeasure = [CurrMeasure] - [PrevMeasure]  
  2. Dynamic Measure:

    SelectedMeasure = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE(Table[MeasureType]) = "Prev", [PrevMeasure],
        SELECTEDVALUE(Table[MeasureType]) = "Curr", [CurrMeasure],
        SELECTEDVALUE(Table[MeasureType]) = "Diff", [DiffMeasure],
        BLANK()
    )
  3. Matrix Setup:

    Add Category and Measure to rows.

    Add MeasureType (Prev, Curr, Diff) to columns.

    Use SelectedMeasure as values.

  4. Apply conditional formatting for Direvtion as needed.

View solution in original post

13 REPLIES 13
reddevil
Helper II
Helper II

 Thank you all for the help, @Akash_Varuna the measure worked.

V-yubandi-msft
Community Support
Community Support

Hi @reddevil ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

 

Thank you.

V-yubandi-msft
Community Support
Community Support

Hi @reddevil ,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.

Thank You.

V-yubandi-msft
Community Support
Community Support

Hi @reddevil ,

In additionto the @Akash_Varuna , response.  To enhance the accuracy and flexibility of your time based filtering, replace string filters with proper time intelligence functions like QUARTER(TODAY()) or DATEADD().  This ensures calculations dynamically adjust to the current date context instead of relying on static text-based filters.

 

Additionally, use VAR to store reusable values and maintain a dynamic date context that aligns with reporting periods. This improves clarity, performance, and consistency across different time-based metrics.

 

If your table contains multiple metric types, consider creating separate dynamic measures (Selected_OpenIssues, Selected_ResolutionTime) to accurately represent distinct reporting needs. This method provides greater flexibility in visualizing and analyzing various data categories within your report.

 

i Hope this helps...

Anonymous
Not applicable

Hi @reddevil ,

Can you please share a pbix or some dummy data that keep the raw data structure with expected results? It should help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Hi XiaoXin,

I have already provided a table above which has measures in rows and there is previous and current quarters(columns) which needs to be calculated against those measures. There is also a date slicer on top. Please let me know if you require any further information.

 

Anonymous
Not applicable

Hi @reddevil,

The table you shared is a pivoted result table and it also not include any date fields. For these sample, we are hard to test and coding formula on it.

For previous date calculation, you can add a variable to get the current date. Then you can use current category and the current date to find the max date that less than current date and category equal to the current category as previouse date.

Regards,

Xiaoxin Sheng

Thanks for your reply, but the above table is the one which i require as final output, the earlier measure provided by Akash is somewhat similar except we have a reporting period of every quarter end and previous quarter and using those date we have to calculate the measures like open issues, avg resolution time, can you please guide how do i calculate measures using reporting period of current quarter and previous quarters that would be helpful.

Akash_Varuna
Super User
Super User

Hi @reddevil Could you try this please create measures first for three seperatly and then do SWITCH statement in dax please check this 

  1. Create Measures:
    Define prev , curr , and diff measures:

    PrevMeasure = CALCULATE(SUM(Table[Value]), FILTER(Table, Table[Quarter] = "Previous"))  
    CurrMeasure = CALCULATE(SUM(Table[Value]), FILTER(Table, Table[Quarter] = "Current"))  
    DiffMeasure = [CurrMeasure] - [PrevMeasure]  
  2. Dynamic Measure:

    SelectedMeasure = 
    SWITCH(
        TRUE(),
        SELECTEDVALUE(Table[MeasureType]) = "Prev", [PrevMeasure],
        SELECTEDVALUE(Table[MeasureType]) = "Curr", [CurrMeasure],
        SELECTEDVALUE(Table[MeasureType]) = "Diff", [DiffMeasure],
        BLANK()
    )
  3. Matrix Setup:

    Add Category and Measure to rows.

    Add MeasureType (Prev, Curr, Diff) to columns.

    Use SelectedMeasure as values.

  4. Apply conditional formatting for Direvtion as needed.

Hi 

Can you please help.

Hi @Akash_Varuna 

The current measure is calculated based on previous quarter -1 quarter and the previous quarter measure is just sumx(total open issues ), dateadd([max satatus date),-1, quarter). I also have a slicer which is based on created date Year/Quarter and Months.

Hi @Akash_Varuna 

We are calculating current measure like this : 

VAR current__open=  CALCULATE(SUMX(Issues,[Total Open Issues]), FILTER(Issues, QUARTER(Issues[Create Date]) = QUARTER(TODAY())))

Thanks @Akash_Varuna for replying, I will try the above measure and would let you know.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Kudoed Authors