Forum Discussion
Creating an Index column based on a calculated column and a regular column
- 4 years ago
Hi RH10 ,
How about this:
here the code:
Column = RANKX ( FILTER ( Table, Table[Year (Calculated)] = EARLIER ( Table[Year (Calculated)] ) && Table[Course name] = EARLIER ( Table[Course name] ) ), Table[Date], , ASC , DENSE )For reference:
Let me know if this helps! 🙂
By the way, I would still recommend to solve it in Power Query. You could even create your calculated column in PowerQuery, too. But since your requirement was to do it in DAX, I provided the solution in DAX as well./Tom
https://www.tackytech.blog/
https://www.instagram.com/tackytechtom/
Hi,
here a solution in power query
to obtain it you have :
- first to create the year column
- then group by
- add a index column in AllRows
- maintain only this last created column
- expand all
and finally remove unnecessary columns
If this post is useful to help you to solve your issue consider giving the post a thumbs up
and accepting it as a solution !
Hello serpiva64 ,
Thank you for your solution. Unfortunately, it does not work properly. My actual data is somewhat messy, as this project that I'm working on is supposed to be updated throughout the year. As of now, there are courses that don't have a specific date and are left blank, or just has a month, or just has the year. I apologize for not making this clear earlier. I actually tried to use the Power Query editor to create the Year column, but I couldn't figure out how to get it work (I'm still new to the Power BI system). Anyway, since the date column is somewhat random in my dataset, I would like to avoid using it, which is why I created the calculated Year column using DAX functions. So I would like to use that Year column to create the index. Is it possible to do so without using the dates column for the measure?