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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Rahul66303
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
MFelix
Super User
Super User

Hi @Rahul66303,

 

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

 

Regards,

MFelix


Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



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

 

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

Regards

Miguel Félix


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

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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