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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Jithin00
New Member

Dynamically adding rows

Hey all, i have got 4 quaters that is q1=oct,nov,dec     q2=Jan,feb,mar      q3=april,may,june     q4=july,aug,sept

(Note:- When the quater ends it should print the last 2 months data of the quater dynamically.)

So currently q1,q2,q3 is over so the table looks like this, so this is the current state of my report.

 q1q2q3mayjune
Innovations55555
Loyalty44444
Value66666

 

But when quater 4 ends it should dynamically create columns q4, aug, sept and should look like this, so this is the expected output:-

 q1q2q3q4augsept
Innovations555555
Loyaltly444444
Value666666

 

Requesting for help for the above problem.

 

Thankyou

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,@Jithin00 

I am glad to help you.  

 

According to your description, you want to dynamically adding rows? 

If I understand you correctly, then you can refer to my solution.  

 

First of all, I need to point out that the matrix visualization in power BI itself has a lot of limitations and doesn't always exactly fit our needs. For example, you now want to be able to dynamically add new columns to the matrix. 

 

In your requirement, q1, q2 and June are not columns in one dimension, so dynamic addition is not possible. 

 

Now I have a simple example for you. 

 

First you need to customize the matrix. We need to create two tables of our own to hold the columns of the matrix: 

vfenlingmsft_0-1720507418452.png

 

 

vfenlingmsft_1-1720507418454.png

 

Then create a measure for the rows of the matrix. The value of 5 and 6 and 7 in DAX can be replaced with the aggregated values you need to calculate: 

 

vfenlingmsft_2-1720507439653.png

 

 

M_2 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Columner'[option] ) = "Innovations", 5,
    SELECTEDVALUE ( 'Columner'[option] ) = "Loyalty", 4,
    SELECTEDVALUE ( 'Columner'[option] ) = "Value", 6
)

 

 

Then create a measure for the columns of the matrix, where it compares the rows and columns one by one: 

 

vfenlingmsft_3-1720507439657.png

 

 

 

M_1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Header'[level] ) = "quarter",
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Header'[option] ) = "q1", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "q2", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "q3", [M_2]
        ),
    SELECTEDVALUE ( 'Header'[level] ) = "month",
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Header'[option] ) = "may", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "june", [M_2]
        )
)

 

 

This is the final result: 

 

vfenlingmsft_4-1720507452616.png

 

 

I hope this example helps you. 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.


Best Regards,
Fen Ling,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi,@Jithin00 

I am glad to help you.  

 

According to your description, you want to dynamically adding rows? 

If I understand you correctly, then you can refer to my solution.  

 

First of all, I need to point out that the matrix visualization in power BI itself has a lot of limitations and doesn't always exactly fit our needs. For example, you now want to be able to dynamically add new columns to the matrix. 

 

In your requirement, q1, q2 and June are not columns in one dimension, so dynamic addition is not possible. 

 

Now I have a simple example for you. 

 

First you need to customize the matrix. We need to create two tables of our own to hold the columns of the matrix: 

vfenlingmsft_0-1720507418452.png

 

 

vfenlingmsft_1-1720507418454.png

 

Then create a measure for the rows of the matrix. The value of 5 and 6 and 7 in DAX can be replaced with the aggregated values you need to calculate: 

 

vfenlingmsft_2-1720507439653.png

 

 

M_2 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Columner'[option] ) = "Innovations", 5,
    SELECTEDVALUE ( 'Columner'[option] ) = "Loyalty", 4,
    SELECTEDVALUE ( 'Columner'[option] ) = "Value", 6
)

 

 

Then create a measure for the columns of the matrix, where it compares the rows and columns one by one: 

 

vfenlingmsft_3-1720507439657.png

 

 

 

M_1 = 
SWITCH (
    TRUE (),
    SELECTEDVALUE ( 'Header'[level] ) = "quarter",
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Header'[option] ) = "q1", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "q2", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "q3", [M_2]
        ),
    SELECTEDVALUE ( 'Header'[level] ) = "month",
        SWITCH (
            TRUE (),
            SELECTEDVALUE ( 'Header'[option] ) = "may", [M_2],
            SELECTEDVALUE ( 'Header'[option] ) = "june", [M_2]
        )
)

 

 

This is the final result: 

 

vfenlingmsft_4-1720507452616.png

 

 

I hope this example helps you. 

 

I hope my suggestions give you good ideas, if you have any more questions, please clarify in a follow-up reply.


Best Regards,
Fen Ling,


If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

BeaBF
Super User
Super User

@Jithin00 Hi! can you paste the dataset under this matrix?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.