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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

Move Columns to rows, get count, max, min

Hi there, I am new to Power BI and I am stuck trying a matrix. I need to move this columns so they can all be placed into one column, and then I can get the values from it.  My problem is something like this..

 

addr_group        address_id          add_number     add_origin          building             checkstatus

xxxxxxxxxxxx      xxxxxxxxxxx        xxxxxxxxxxxxx    xxxxxxxxxxx        xxxxxxx                xxxxxxxxxxxx

xxxxxxxxxxxx      xxxxxxxxxxx        xxxxxxxxxxxxx    xxxxxxxxxxx        xxxxxxx                xxxxxxxxxxxx

xxxxxxxxxxxx      xxxxxxxxxxx        xxxxxxxxxxxxx    xxxxxxxxxxx        xxxxxxx                xxxxxxxxxxxx

xxxxxxxxxxxx      xxxxxxxxxxx        xxxxxxxxxxxxx    xxxxxxxxxxx        xxxxxxx                xxxxxxxxxxxx

 

 

Into >>>

 

Column                Count                    DistinctCount     Max       Min        NullCount

Addr_group

Address_id

Add_number

Add_origin

Building

Checkstatus

 

 

 Thx for your help

1 ACCEPTED SOLUTION
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

First, Unpivot your data in power Query:

vjianbolimsft_0-1663667964798.png

Here is the M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HYy5DQAxDMN2cZ3ipCT3zGJ4/zXOTCHCsARmhmLE7nwdTfA0rKiR4T5vfhdY4KX1aVkzFg4hERbP07JmLCTCYixeUfUD", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [addr_group = _t, address_id = _t, add_number = _t, add_origin = _t, building = _t, checkstatus = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"addr_group", Int64.Type}, {"address_id", Int64.Type}, {"add_number", Int64.Type}, {"add_origin", Int64.Type}, {"building", Int64.Type}, {"checkstatus", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

Then apply it to the matrix:

vjianbolimsft_1-1663668242245.png

Here is the calculation of NullCount:

NullCount = CALCULATE(COUNT('Table'[Value]),FILTER('Table',[Value]=BLANK()))

(Other Aggregation can use directly)

vjianbolimsft_2-1663668348447.png

Best Regards,

Jianbo Li

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
v-jianboli-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please try:

First, Unpivot your data in power Query:

vjianbolimsft_0-1663667964798.png

Here is the M code:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HYy5DQAxDMN2cZ3ipCT3zGJ4/zXOTCHCsARmhmLE7nwdTfA0rKiR4T5vfhdY4KX1aVkzFg4hERbP07JmLCTCYixeUfUD", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [addr_group = _t, address_id = _t, add_number = _t, add_origin = _t, building = _t, checkstatus = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"addr_group", Int64.Type}, {"address_id", Int64.Type}, {"add_number", Int64.Type}, {"add_origin", Int64.Type}, {"building", Int64.Type}, {"checkstatus", Int64.Type}}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Changed Type", {}, "Attribute", "Value")
in
    #"Unpivoted Columns"

Then apply it to the matrix:

vjianbolimsft_1-1663668242245.png

Here is the calculation of NullCount:

NullCount = CALCULATE(COUNT('Table'[Value]),FILTER('Table',[Value]=BLANK()))

(Other Aggregation can use directly)

vjianbolimsft_2-1663668348447.png

Best Regards,

Jianbo Li

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

 

 

 

 

JorgePinho
Solution Sage
Solution Sage

Put those fields in the Rows Box

 

Then in the Values Box put the measures that you want to see (Count, Distinct Count...)

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors