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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Matrix Table - Using a different column for the subtotal by quarter

This is a bit of a quirky situation and I will spare you the details. An example of my table is as follows:

 

MONTH  EPS MTD  EPS QTD  EPS YTD

JAN0.10.10.1
FEB0.150.250.25
MAR0.20.460.46
APR0.250.250.71
MAY0.30.641.01
JUN0.350.891.38

 

Note: The QTD and YTD values do not neccesarily align 1 to 1 with the MTD (sparing details, there are adjustments made outside of the MTD numbers occasionally)

 

I am looking to build a matrix table to looks as follows:

 

Q1                                                          Q2

JanFebMarTotalAprMayJunTotalYTD Total
0.10.150.20.460.250.30.350.891.38


- The Quarterly total I want to come from my QTD column in my source table (i.e. Q1 total is the Mar QTD value)
- The Monthly numbers i want to come from the MTD column in my source tabke

- The Grand total i want to be the current YTD Total (i.e. the Jun YTD Value)

 

I know it is a bit odd since the values of the months might not add up to the total, but this is something that will help the organization.

 

I am open in any way to modifying using power query to make the data work easier, I am just not sure there is a simple solution to this.

 

Thanks!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

@Anonymous 

You should be able to use ISINSCOPE to check what "level" you are at (month, qtr, year) and sum the right column based on that.

 

 

Measure = SWITCH (
    TRUE(),
    ISINSCOPE(Dates[Month]),SUM(YourTable[Month]),
    ISINSCOPE(Dates[Quarter]),SUM(YourTable[Quarter]),
    ISINSCOPE(Dates[Year]),SUM(YourTable[Year]),
    SUM(YourTable[Month])
)

 

2022-01-18_12-22-44.png

You just need to decide what to do for the grand total.  In mine, I did the month column but you probably want the year again.

View solution in original post

1 REPLY 1
jdbuchanan71
Super User
Super User

@Anonymous 

You should be able to use ISINSCOPE to check what "level" you are at (month, qtr, year) and sum the right column based on that.

 

 

Measure = SWITCH (
    TRUE(),
    ISINSCOPE(Dates[Month]),SUM(YourTable[Month]),
    ISINSCOPE(Dates[Quarter]),SUM(YourTable[Quarter]),
    ISINSCOPE(Dates[Year]),SUM(YourTable[Year]),
    SUM(YourTable[Month])
)

 

2022-01-18_12-22-44.png

You just need to decide what to do for the grand total.  In mine, I did the month column but you probably want the year again.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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