cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Rigolleto Regular Visitor
Regular Visitor

Create a new column with only one value

Hi,

Somebody could help me or give me some code to build a new column, "new column", how can you see the "sale LY" has duplicated the sales for the grouping season/grm/style, Do I need is to create a new column and left only one value, as the scheen shown, for every single group, I did try a max and sum, but my lack of knowledge is killing me

 

Thanks in advance

 

 

 

 

salesImage.png

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Create a new column with only one value

Hi @Rigolleto ,

 

We can create a calculate column using following DAX to meet your requirement.

 

New column = 
VAR season = [season]
VAR grm = [grm]
VAR style = [style]
VAR ft =
    FILTER (
        ALL ( Example ),
        'Example'[season] = season
            && 'Example'[grm] = grm
            && 'Example'[style] = style
    )
RETURN
    IF ( [sales] = MAXX ( ft, [sales] ), [salesLY], BLANK () )

Create-a-new-column-with-only-one-value-1.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more 

Community Support Team _ Dong 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

1 REPLY 1
Community Support Team
Community Support Team

Re: Create a new column with only one value

Hi @Rigolleto ,

 

We can create a calculate column using following DAX to meet your requirement.

 

New column = 
VAR season = [season]
VAR grm = [grm]
VAR style = [style]
VAR ft =
    FILTER (
        ALL ( Example ),
        'Example'[season] = season
            && 'Example'[grm] = grm
            && 'Example'[style] = style
    )
RETURN
    IF ( [sales] = MAXX ( ft, [sales] ), [salesLY], BLANK () )

Create-a-new-column-with-only-one-value-1.png

 

BTW, pbix as attached.

 

Community Support Team _ DongLi
If this post helps, then please consider Accept it as the solution to help the other members find it more 

Community Support Team _ Dong 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

Helpful resources

Announcements
Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors