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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Values form multiple rows to one row

Hello,

I would like to have values from multiple rows into one row.

 

For this ID i have multiple dates in multiple rows which i would like to have in one row.

 Picture1.PNG
I would like to do this in dax, because i filter these dates in multiple columns after i imported the data.

Anyone an idea of how to do this?


1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a Table using DAX like below.

Table 2 = 
ADDCOLUMNS(
    VALUES( 'Table'[ID] ),
    "Date1", CALCULATE( MAX( 'Table'[Date1] ) ),
    "Date2", CALCULATE( MAX( 'Table'[Date2] ) ),
    "Date3", CALCULATE( MAX( 'Table'[Date3] ) )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

View solution in original post

3 REPLIES 3
sanjay009
Helper III
Helper III

Please help how can i do this scenario.

placesAMA00241_mangoes_rawAMA01234_banana_rawAMA04545_apples_rawTypeID
TexasAvailableAvailable Oragnic fruitA0001
VirginiaAvailableAvailable Oragnic fruitA0001
MDAvailable AvailableOragnic fruitA0001
DCAvailableAvailable Oragnic fruitA0001
VAAvailableAvailableAvailableOragnic fruitA0001
CAAvailableAvailable Regular FruitB0001
NJAvailableAvailable Regular FruitB0001
NYAvailable AvailableRegular FruitB0001
DEAvailableAvailable Regular FruitB0001
PAAvailableAvailableAvailableRegular FruitB0001

Expected Results:

AMA00241_mangoes_rawAMA01234_banana_rawAMA04545_apples_rawTypeID
AvailableAvailableAvailableOragnic fruitA0001
AvailableAvailableAvailableRegular FruitB0001

 

The column names contains like

month 1 - AMA00241_mangoes_raw, AMA01234_banana_raw,AMA04545_apples_raw, Type,ID,places

month2 - AMA03432_mangoes_ft, AMA01434_banana_ft,AMA04535_apples_ft, AMA09095_grapes_ft,AMA0005_pear_ft,Type,ID,places

month3 - AMA03345_peach_raw, AMA00034_orange_ft,Type,ID,places

The dynamic cloumn name contains like AMA0%

 

Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can create a Table using DAX like below.

Table 2 = 
ADDCOLUMNS(
    VALUES( 'Table'[ID] ),
    "Date1", CALCULATE( MAX( 'Table'[Date1] ) ),
    "Date2", CALCULATE( MAX( 'Table'[Date2] ) ),
    "Date3", CALCULATE( MAX( 'Table'[Date3] ) )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
Mariusz Repczynski

 

Anonymous
Not applicable

Thanks @Mariusz 

This is the solution!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors