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

Dynamic header in matrix

I have a table sales:

SalesID. Date. Geography

1.       2020-01.  Italy
1.       2020-01.  France
1.       2020-01.  UK
2.       2020-02.  Italy
2.       2002-02.  Canada
3.       2002-08.  France

Within powerqueryM, I' able to pivot the table. Now the result:

SalesID. Date. Geography1 Geography2.    Geography3
1.    2020-01.   Italy. France. Uk
2.  2020-02.  Italy.  Canada.  Null
3. 2020-08. France

How can I add dynamically the Geography 1, Geography 2.. in a matrix. The number of columns Geography is unlimited and unexpected. For example, if I'll have Geography 4, how to add it dynamically in the matrix header?

1 ACCEPTED SOLUTION
MFelix
Super User
Super User

Hi @Anonymous ,

 

You do not need to have the table pivoted if you had a column with the Geopgraphy level that you want maknig a count of the rows this will give your the Geography level 1, 2,  and so on.

 

Using this post you can create an addiotional column with the Index and then geography:

https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

 

Now just use that to make it varialbe:

MFelix_0-1607622407283.pngMFelix_1-1607622434376.png

 

 

See file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

2 REPLIES 2
v-easonf-msft
Community Support
Community Support

Hi, @Anonymous 

It seems that @MFelix 's solution can meet your requirement.
If so,  please accept it as  soultion to close this thread.
More people will learn new things here. If you haven't, please feel free to ask.

 

Best Regards,
Community Support Team _ Eason

 

MFelix
Super User
Super User

Hi @Anonymous ,

 

You do not need to have the table pivoted if you had a column with the Geopgraphy level that you want maknig a count of the rows this will give your the Geography level 1, 2,  and so on.

 

Using this post you can create an addiotional column with the Index and then geography:

https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

 

Now just use that to make it varialbe:

MFelix_0-1607622407283.pngMFelix_1-1607622434376.png

 

 

See file attach.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



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.