Forum Discussion

Rahul66303's avatar
Rahul66303
Frequent Visitor
8 years ago

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

    • Rahul66303's avatar
      Rahul66303
      Frequent Visitor

      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

       

      • MFelix's avatar
        MFelix
        Super User
        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