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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
garythomannCoGC
Impactful Individual
Impactful Individual

Best approach for concept of grouping column values

Have a simple table of values.  Wanting to group (ie switch) some of the values as one value to represent these subset of values.

 

For example the table could have a range of 'blank' values.  But we want to group all 'blank' values under one label, lets say 'blank'

So our dax and switch statement will look like this

 

-- dax query to group 'blank' values into one label while leaving all non-'blank' values
DEFINE
    VAR RubbishTable = DISTINCT ( VALUES ('table with various blanks'[<column>]))
    VAR UnRubbishTable = 
        DAX (
            DAX (
                SWITCH (
                    [<column>], 
                    "rubbishA", "blank", 
                    "rubbishB", "blank", 
                    "rubbishC", "blank", 
                    [<column>]
                 )
            )
        )

EVALUATE
    UnRubbishTable

 

Thanks in advance

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@garythomannCoGC , You need create a new column for each column

DAX

 

new column =  Switch(True() ,

isblank([COlumn]) , "NA" ,

// Add other conditions

[COlumn]

)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

3 REPLIES 3
garythomannCoGC
Impactful Individual
Impactful Individual

Simple one column table.  Dax process to produce a set of unique values.  Rubbish data to be grouped under one label value.

Inputs

rubbish A
rubbish B
good value
rubbish C
good value
rubbish A
good value
great value

Outputs

NA
good value
great value

Thus the 'rubbish' are grouped under NA.

I hope that this makes sense and thank you for your prompt to provide data and the link provided.

Thanks @VahidDM 

VahidDM
Super User
Super User

Hi @garythomannCoGC 

 

Can you post sample data as text and expected output?


please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
4. Relation between your tables

Appreciate your Kudos!!
LinkedIn:www.linkedin.com/in/vahid-dm/

amitchandak
Super User
Super User

@garythomannCoGC , You need create a new column for each column

DAX

 

new column =  Switch(True() ,

isblank([COlumn]) , "NA" ,

// Add other conditions

[COlumn]

)

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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.