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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
viajero03082
Regular Visitor

Data segmentation

Hello everyone 😀

Q= How can I extract and name the following Alloc?

I have a problem with the next data separation

viajero03082_0-1619401729689.png

 

I have to get the different alloc (alloc_2, alloc_3 ....) with the help of the id and dates

That is, an S1 id will Alloc_1, Alloc_2, Alloc_3, Alloc_4 because it has 4 dates

viajero03082_0-1619387747246.png

For alloc_1 it is easy to create a column that extracts the first date relative to the id

viajero03082_1-1619387764445.png

 

1st = CALCULATE(FIRSTDATE('Tabla2 (2)'[DATE]), ALLEXCEPT('Tabla2 (2)','Tabla2 (2)'[show_id]))

 

Then a Conditional to name

viajero03082_2-1619387773015.png

 

Alloc_1 = if('Tabla2 (2)'[DATE]=BLANK(),"0_ALLOC",if('Tabla2 (2)'[DATE]='Tabla2 (2)'[1st],"Alloc_1","Alloc_n"))

 

How can I extract and name the following Alloc?

 

1 ACCEPTED SOLUTION
Fowmy
Super User
Super User

@viajero03082 

You can use RANKX to create the sequence. Use the code below for your column. T5 is my table name, you can replace it with yours.

Allocation = 
IF(
    [DATE]=BLANK(),
    "0_ALLOC",
    RANKX( FILTER(T5,T5[show_id] = EARLIER(T5[show_id])) , T5[DATE] ,,ASC) & "_ALLOC"
)

Fowmy_0-1619390380135.png

 

 

 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@viajero03082 

 

Such things should be done in Power Query. Not in DAX. I'd kindly suggest you use the right tool for the job. "The fact that something can be done does not mean it should be done"... to cite the long-standing adage.

Fowmy
Super User
Super User

@viajero03082 

You can use RANKX to create the sequence. Use the code below for your column. T5 is my table name, you can replace it with yours.

Allocation = 
IF(
    [DATE]=BLANK(),
    "0_ALLOC",
    RANKX( FILTER(T5,T5[show_id] = EARLIER(T5[show_id])) , T5[DATE] ,,ASC) & "_ALLOC"
)

Fowmy_0-1619390380135.png

 

 

 





Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.