The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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
Solved! Go to Solution.
@garythomannCoGC , You need create a new column for each column
DAX
new column = Switch(True() ,
isblank([COlumn]) , "NA" ,
// Add other conditions
[COlumn]
)
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
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/
@garythomannCoGC , You need create a new column for each column
DAX
new column = Switch(True() ,
isblank([COlumn]) , "NA" ,
// Add other conditions
[COlumn]
)
User | Count |
---|---|
26 | |
10 | |
8 | |
6 | |
6 |
User | Count |
---|---|
31 | |
12 | |
10 | |
10 | |
9 |