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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Mat42
Resolver I
Resolver I

Calculated Column Different First Entry

Let's say I have a couple of columns in a dataset that look like this:

 

ProjectStage
Email MigrationA
Email MigrationA
Email MigrationA
Email MigrationA
Email MigrationA
Email MigrationA
Email MigrationA
Laptop ReplacementB
Laptop ReplacementB
Laptop ReplacementB
Laptop ReplacementB
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Office RefurbC
Kitchen RefitB
Kitchen RefitB
Kitchen RefitB

 

I'd like to add in a calculated column that looks at the Stage column and assigns a numeric value to each letter group, but a different value to the first of each group. So, for instance, Stage A would be allocated the number 1, but the first of the group would be 11. Likewise stage B would be allocated the number 2, but the first for each B stage would be allocated 22 etc.

 

So, the column would look like this:

 

ProjectStageValue
Email MigrationA11
Email MigrationA1
Email MigrationA1
Email MigrationA1
Email MigrationA1
Email MigrationA1
Email MigrationA1
Laptop ReplacementB22
Laptop ReplacementB2
Laptop ReplacementB2
Laptop ReplacementB2
Office RefurbC33
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Office RefurbC3
Kitchen RefitB22
Kitchen RefitB2
Kitchen RefitB2

 

Any ideas?

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@Mat42 You will need to add an Index to your table and then the problem is trivial as you can get the MIN value of the Index for the group and compare to the current value and make your decision.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@Mat42 You will need to add an Index to your table and then the problem is trivial as you can get the MIN value of the Index for the group and compare to the current value and make your decision.



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!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler. I really need sleep and that solution is about the only thing I haven't treid.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.