cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lizsz Frequent Visitor
Frequent Visitor

Create group

 

 

Hi,

 

I have a live connection to a database due to which the group function is not enabled in Power BI. So I’m looking for other ways to visualize the data in Power BI in a grouped way. I was thinking this should work using a new measure, but I can’t figure out the proper DAX function to do so.

 

The values I need to group and display in the report are stored in a table called “Measures” in the field “amount”. The values I want to group, are stored in a table “Description” in the field “name”. I'd like to label them by saying if name = Apple or Banana, the new label newname = Fruit, else it is Vegetable.

 

What would be the best way to do this?

 

Thx -

 

Amount (table Measures)//Name (table Description)//newname

1//Apple//Fruit

2//Banana//Fruit

3//Lettuce//Vegetable

4//Apple//Fruit

5//Banana//Fruit

6//Lettuce//Vegetable

4 REPLIES 4
Till Regular Visitor
Regular Visitor

Re: Create group

Hey,

 

i hope i understand you correctly.

you can backed this with the IF function in Power BI

IF(logical_test>,<value_if_true>, value_if_false)  

For more values combinated with If(and.....

Regards
Till

Highlighted
lizsz Frequent Visitor
Frequent Visitor

Re: Create group

Thank you Till for the reply. I had tried to use IF, but seem not able to work out the proper function. I have no experience with DAX and have been looking around, but am probably just missing some basics to figure it out.

 

My attempt was:

group = IF(OR(Description[Name] = “Apple”, Description[Name] = “Banana”);”Fruit”;”Vegetable”)

 

Could you help me indicate what needs to be corrected?

 

Many thanks -

Till Regular Visitor
Regular Visitor

Re: Create group

Hey,

now it is clear:
Step One:
Make a new column in your table with this measure
Spalte = if(OR('Tabelle 1'[Name]="Apfel";'Tabelle 1'[Name]="Banane");"Fruit";"Vegetable")

2018-01-14_174144.jpg

 This works.
Kind regards
Till

lizsz Frequent Visitor
Frequent Visitor

Re: Create group

Hi,

 

I receive an error on this, indicating that a single value for column 'name' in table 'Description' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count or sum to get a single result.

 

Could this be related to not being able to define a new column when working with a live connection? Would there be another way or an update to the DAX formula that could still bring the result?

 

Thanks,

 
 
 

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 206 members 1,874 guests
Please welcome our newest community members: