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

Need help - Pivot with if exist

Hi All,

 

Need a help with if Exist in DAX, below is my problem statement :

 

I need to pivot two columns in my table for below data :

 

ChannelValue
Channelone
Channelone
Channelone
Channelone
Channelone
Channeltwo
Channeltwo
Channeltwo
Channeltwo

 

After pivot above columns it should transform as per below :

 

Channel
one
one
one
one
one
two
two
two
two

 

But if Column Channel already exists then it should not pivot instead it need to copy values from Value column.

 

Thanks,

Rahul

3 REPLIES 3
Super User
Super User

Re: Need help - Pivot with if exist

Hi @Rahul66303,

 

You should do this in the query editor using the pivot option.

 

Regards,

MFelix



Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Rahul66303 Frequent Visitor
Frequent Visitor

Re: Need help - Pivot with if exist

Yes that is we can do pivot in query editor but my ask is before doing pivot it should check for column (in this case Channel) already exist on table if Yes then it should just copy the value of channel and discard pivot.

 

ChannelValue
Channelone
Channelone
Channelone
Channelone
Channelone
Channeltwo
Channeltwo
Channeltwo
Channeltwo

 

Super User
Super User

Re: Need help - Pivot with if exist

Not really understanding your question, the query editor is like a macro so it always get the information in the.same format make the changes, formatting whatever you program it and repeat the process every time you refresh the data.

So if the source data is always in the format you present it will always be get on that way and then unpivoted.

Or are you getting information.on different formats each time?

Regards,
MFelix


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!




Helpful resources

Announcements
Ask Amir Anything

Exclusive LIVE Community Event No. 2 – Ask Amir Anything

Next in our Triple A series: Ask Amir Netz questions about the latest updates, features and future.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 63 members 1,087 guests
Please welcome our newest community members: