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 August 31st. Request your voucher.

Reply
ArquimedesP
Helper I
Helper I

Add columns to matrix visual with hierarchy DAX

Hi guys, I'm trying to add 3 new columns after  the total column at the end of a matrix visual but I haven't being able to get it right.

 

I have this tables:

 

Quarters (no conected table)                                  

 

ArquimedesP_0-1625691693117.png

 

VW_Depositos_Unicos (example):

 

ArquimedesP_2-1625691853440.png

 

And this is their connections:

 

 

ArquimedesP_4-1625691977567.png

 

I use this measure to get this matrix:

 

Importes_por_Quarters =
VAR Q1= SELECTEDVALUE(Quarters[Value],"I Trim")
VAR Q2= SELECTEDVALUE(Quarters[Value],"II Trim")
VAR Q3= SELECTEDVALUE(Quarters[Value],"III Trim")
VAR Q4= SELECTEDVALUE(Quarters[Value],"IV Trim")
VAR Q5= SELECTEDVALUE(Quarters[Value],"Total")
VAR _Q1= CALCULATE(SUM(VW_Depositos_Unicos[Importe]),VW_Depositos_Unicos[Trimestre_Vencimiento]="1Q")
VAR _Q2= CALCULATE(SUM(VW_Depositos_Unicos[Importe]),VW_Depositos_Unicos[Trimestre_Vencimiento]="2Q")
VAR _Q3= CALCULATE(SUM(VW_Depositos_Unicos[Importe]),VW_Depositos_Unicos[Trimestre_Vencimiento]="3Q")
VAR _Q4= CALCULATE(SUM(VW_Depositos_Unicos[Importe]),VW_Depositos_Unicos[Trimestre_Vencimiento]="4Q")
VAR _Q5= SUM(VW_Depositos_Unicos[Importe])
RETURN
IF(HASONEVALUE(Quarters[Value]),IF(Q1="I Trim",_Q1,IF(Q2="II Trim",_Q2,IF(Q3="III Trim",_Q3,IF(Q4="IV Trim",_Q4,_Q5)))),_Q5)
 
ArquimedesP_5-1625692112593.png

 

And this is my values:

 

ArquimedesP_6-1625692196694.png

 

How should I change the Measure to add columns and respect the Hierarchy??

 

Thanks.

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

@ArquimedesP You cannot add columns after the totals.  You can remove the totals and create your own custom matrix 

https://community.powerbi.com/t5/Community-Blog/Creating-a-custom-or-hybrid-matrix-in-PowerBI/ba-p/1...

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

@ArquimedesP You cannot add columns after the totals.  You can remove the totals and create your own custom matrix 

https://community.powerbi.com/t5/Community-Blog/Creating-a-custom-or-hybrid-matrix-in-PowerBI/ba-p/1...

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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