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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Anonymous
Not applicable

DAX Question: copy column value but change at certain interval (text)

I would like to copy the rows from the first column to the second. 

Whenever the logic comes to a row with "VC" I would like "VC" copied instead until the next "VC" value. 

Then, it returns to copying the row in the first column.

 

Column(Value to return)
XXXX
XXXX
XXXX
XXXX
VCVC
BYVC
BYVC
BYVC
BYVC
BYVC
VCVC
BYBY
BYBY
BYBY
BYBY
BYBY
VCVC
BYVC
XXVC
VCVC
XXXX
XXXX

 

8 REPLIES 8
Anonymous
Not applicable

Power Query is the tool to do such things... Please have a look:

 

https://1drv.ms/u/s!ApyQEauTSLtOgYMozxOFMkHiel9nYg?e=8az3Ym

 

Best

D

Anonymous
Not applicable

Can you send this to joshscha@gmail.com?

@Anonymous 

Anonymous
Not applicable

Again... Such things are easily performed in Power Query and should be performed there. DAX is not a data mashup language; it's a Data Analysis eXpressions language.

Best
D
Anonymous
Not applicable

@Anonymous

So interesting! I'll try as soon as I can and get back to you. 

 

Anonymous
Not applicable

I will give you logic just check for occurance of vc and increment it by 1.

So everytime we need to fill vc from odd to even.
Greg_Deckler
Super User
Super User

Having a hard time wrapping my head around the logic that is desired here. But, mabye something like Cthulhu: 

https://community.powerbi.com/t5/Quick-Measures-Gallery/Cthulhu/td-p/509739



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

I changed the discription a bit, maybe it's clearer. thanks. 

Anonymous
Not applicable

Hi @Anonymous 

 

Create one index column.

 

Then create below two columns

Rank =
VAr rank_check=RANKX(FILTER(Sheet4,Sheet4[Column]=EARLIER(Sheet4[Column])&&Sheet4[Column]="VC"),Sheet4[Index],,ASC)
return
IF(Sheet4[Column]="VC",rank_check,BLANK())
 
Output =
var final= IF(Sheet4[Rank]=BLANK(),CALCULATE(LASTNONBLANK(Sheet4[Rank],0),FILTER(Sheet4,Sheet4[Index]<EARLIER(Sheet4[Index]))))
return
IF(MOD(final,2)>0,"VC",Sheet4[Column])
 
 
Capture6.PNG
 
 
Thanks & regards,
Pravin Wattamwar
www.linkedin.com/in/pravin-p-wattamwar

If I resolve your problem Mark it as a solution and give kudos.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.