Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
Colleagues, hello!
I have a column with a period and a number of rows with data that equals the number of days in a month.
How can I put days from 1 to 28-31 in a separate column?
Solved! Go to Solution.
Hi @pani_victoria ,
To achieve this in Power BI, you can create a calculated column that assigns a day number (1 to 28/31) to each row within the month.
Create a Calculated Column: Use the following DAX formula to create a new column for days:
DayNumber =
RANKX(
FILTER(
TableName,
TableName[Period] = EARLIER(TableName[Period])
),
TableName[IndexColumn],
,
ASC
)
Result: This formula will rank rows within each month, creating day numbers 1 to 28/31 in a new column.
Please mark this as solution if it helps. Appreciate Kudos.
Hi @pani_victoria ,
To achieve this in Power BI, you can create a calculated column that assigns a day number (1 to 28/31) to each row within the month.
Create a Calculated Column: Use the following DAX formula to create a new column for days:
DayNumber =
RANKX(
FILTER(
TableName,
TableName[Period] = EARLIER(TableName[Period])
),
TableName[IndexColumn],
,
ASC
)
Result: This formula will rank rows within each month, creating day numbers 1 to 28/31 in a new column.
Please mark this as solution if it helps. Appreciate Kudos.
Thank you!
It works!)
but not for me
I didn't take into account some input data, because of which this solution doesn't work correctly