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
Boopep
Helper I
Helper I

Grouping of values from different col

Hi asking for help.

I want to group values from different columns. i want to group the cost value in column Q3.1. A Cost, Q3.1.B Cost, Q3.1. Cost, Q3.1.D Cost to 0, blank, 1-500, 501-1000, >1000

 

excel.jpg

Chatgp suggested me this DAX Measure but it doesnt work.

 

Q3 Cost List Grouped =

VAR CostsTable =

    {

        [Q3.1. A Cost],

        [Q3.1.B Cost],

        [Q3.1.C Cost],

        [Q3.1.D Cost],

        [Q3.1.E Cost],

        [Q3.1.Other Amenity Cost]

    }

RETURN

CONCATENATEX(

    ADDCOLUMNS(

        SELECTCOLUMNS(

            GENERATESERIES(1, 6, 1),

            "Cost", SWITCH([Value],

                1, [Q3.1. A Cost],

                2, [Q3.1.B Cost],

                3, [Q3.1.C Cost],

                4, [Q3.1.D Cost],

                5, [Q3.1.E Cost],

                6, [Q3.1.Other Amenity Cost]

            )

        ),

        "Group",

        VAR c = [Cost]

        RETURN

            SWITCH(

                TRUE(),

                ISBLANK(c), "Blank",

                c = 0, "0",

                c >= 1 && c <= 500, "1-500",

                c >= 501 && c <= 1000, "501-1000",

                c > 1000, ">1000",

                BLANK()

            )

    ),

    [Group],

    ", "

)

 

1 ACCEPTED SOLUTION

Hi @Boopep ,

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). 

Do not include sensitive information. Do not include anything that is unrelated to the issue or question. 

Please show the expected outcome based on the sample data you provided. 

 
Thank you.

View solution in original post

8 REPLIES 8
v-menakakota
Community Support
Community Support

Hi @Boopep 

Thanks for reaching out to the Microsoft fabric community forum. 

I would also take a moment to thank  @rajendraongole1 , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference. 
May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve.

Best Regards, 
Menaka.
Community Support Team  

 

not yet.... hope you can help me with this

Hi @Boopep ,

Please provide sample data that covers your issue or question completely, in a usable format (not as a screenshot). 

Do not include sensitive information. Do not include anything that is unrelated to the issue or question. 

Please show the expected outcome based on the sample data you provided. 

 
Thank you.

Hi @Boopep ,

As we haven’t heard back from you, so just following up to our previous message. I'd like to confirm if you've successfully resolved this issue or if you need further help. 

If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. If you find a reply particularly helpful to you, you can also mark it as a solution. 
If you still have any questions or need more support, please feel free to let us know. We are more than happy to continue to help you. 
Thank you for your patience and look forward to hearing from you. 

Hi  @Boopep ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster. 

 

Thank you. 

Hi @Boopep ,

Can you please confirm whether you have resolved issue. If yes, you are welcome to share your workaround and mark it as a solution so that other users can benefit as well. This will be helpful for other community members who have similar problems to solve it faster. 

If we don’t hear back, we’ll go ahead and close this thread.Should you need further assistance in the future, we encourage you to reach out via the Microsoft Fabric Community Forum and create a new thread. We’ll be happy to help.

Thank you.

 

rajendraongole1
Super User
Super User

Hi @Boopep  - you can use the concatenate as like below measure:

 

Q3 Cost List Grouped =
VAR Costs = {
[Q3.1. A Cost],
[Q3.1.B Cost],
[Q3.1.C Cost],
[Q3.1.D Cost]
}
VAR Grouped =
ADDCOLUMNS (
SELECTCOLUMNS ( Costs, "Cost", [Value] ),
"Group",
SWITCH (
TRUE(),
ISBLANK([Cost]), "Blank",
[Cost] = 0, "0",
[Cost] >= 1 && [Cost] <= 500, "1-500",
[Cost] >= 501 && [Cost] <= 1000, "501-1000",
[Cost] > 1000, ">1000",
"Unknown"
)
)
RETURN
CONCATENATEX ( Grouped, [Group], ", " )

 

Hope this helps.





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

Proud to be a Super User!





Table constructor cannot have optional argument.

 

That is the error i encountered 

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.