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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GRedhead
Helper I
Helper I

How can i number rows in a table by year?

How can I number rows in a table by year?

i.e.

Test  1/1/2021      Row 1

Test  1/9/2021      Row 2

Test  1/1/2022      Row 1

Test  2/2/2022      Row 2

Any suggestions are appreciated.

1 ACCEPTED SOLUTION

Hi @GRedhead 

 

Okay, change your Measure 1 to the following:

 

Measure 1 = DISTINCTCOUNT ('accounts (KPI Page)'[accountid] )

 

Then, change your Measure 2 to the following:

 

Measure 2 = CALCULATE ( [Measure 1] , DATESYTD ( 'FC Calendar'[Date] , "31/3" ) )

 Make sure to drag your Measure 2 to the Values section like below:

TheoC_2-1645997187230.png

 

Also, change your Scalar Type to Linear (it was on Log):

 

TheoC_3-1645997221168.png

 

Hope this helps mate!

Theo 

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

View solution in original post

21 REPLIES 21
GRedhead
Helper I
Helper I

Just tried that and get the following, it still is not totaling up the records each month and is instead showing the total for each month individully. 😞

 

GRedhead_2-1645964941679.png

 

I really appreicte your help on this so far.

 

I have the Pbix but not sure how to uplaod here.

GRedhead
Helper I
Helper I

Hi @Ashish_Mathur and @TheoC ,

 

I have fixed the column to start at April thanks Theo (I created a new calendar table for my fiscal year and linked the account to it by the created on) and have added a YTD field and get the following.

GRedhead_0-1645953799520.png

I just need to now have a continuous line counting the number of accounts going up each month by year.

My table just lists all the created on dates and the account details, so i want to count the number of accounts each month by year and see the number go up each month. i.e. Jan 2022 '10' Feb 2022 '15' (the 10 from January plus the 5 new added in February, and so on...) then have a line shown in the chart per year.

Hi @GRedhead 

 

Okay, add two measuers:

 

Measure 1 = COUNTROWS ( Table )

Measure 2 = CALCULATE ( [Measure 1] , DATESYTD ( Dates[Date] ) l

 

Hopefully this will help get you the outcome! Add Measure 2 to the visual.

 

Let me know how it goes!

 

Theo 🙂

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi @TheoC 

 

Just tried that and get the following, it still is not totaling up the records each month and is instead showing the total for each month individully. 😞

GRedhead_0-1645963341552.png

I really appreicte your help on this so far.

 

I have the Pbix but not sure how to uplaod here.

Hi @GRedhead 

 

You should be able to share the PBIX via OneDrive, DropBox, Google Drive or another similar platform. 

 

Thanks in advance. 

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Link to One Drive source file now removed, message below is the solution.

Hi @GRedhead 

 

Okay, change your Measure 1 to the following:

 

Measure 1 = DISTINCTCOUNT ('accounts (KPI Page)'[accountid] )

 

Then, change your Measure 2 to the following:

 

Measure 2 = CALCULATE ( [Measure 1] , DATESYTD ( 'FC Calendar'[Date] , "31/3" ) )

 Make sure to drag your Measure 2 to the Values section like below:

TheoC_2-1645997187230.png

 

Also, change your Scalar Type to Linear (it was on Log):

 

TheoC_3-1645997221168.png

 

Hope this helps mate!

Theo 

 

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Icey
Community Support
Community Support

Hi @GRedhead ,

 

Do you mean something like below?

Icey_1-1644310555999.png

 

Steps:

 

1. Create columns.

 

FY = 
IF (
    MONTH ( [Date] ) >= 4,
    "FY " & RIGHT ( [Year], 2 ),
    "FY "
        & RIGHT ( [Year] - 1, 2 )
)
MonthName = FORMAT([Date],"mmmm")
MonthOrder = 
IF ( MONTH ( [Date] ) >= 4, MONTH ( [Date] ) - 3, MONTH ( [Date] ) + 9 )

 

 

2. Sort "MonthName" column by "MonthOrder" column.

Icey_2-1644310636839.png

 

3. Create a line chart.

Icey_3-1644310724731.png

 

 

 

Best Regards,

Icey

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Icey
Community Support
Community Support

Hi @GRedhead ,

 

Do you have any comments based on my and @TheoC 's solution?

 

 

Best Regards,

Icey

TheoC
Super User
Super User

Hi @GRedhead 

 

You can use a Calculated Column to get the output you need.  If it's only two years, then you can use an IF statement:

 

Column = if ( RIGHT ( DATES[MyDate] , 4 ) = "2021" , "Row 1" , IF ( RIGHT ( DATES[MyDate] , 4 ) = "2022" , "Row 2" , "Row 3" ))

Hope this helps! 🙂

Theo

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Thanks for the reply, and if it runs over a number of years and has a varying number of rows per year?

From there, I recommend using Power Query.  Conditional Columns are very easy and no code required.

 

TheoC_0-1643843897830.png

And this is the actual Conditional Column interface:

TheoC_1-1643843974028.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

The above is not working for me.
My table has dates from yesterday back to 2014 
I want to add a column that counts up by each row in each year, so I can make a line chart starting at 1 each year and going up over the year as below.

 

GRedhead_0-1643879764726.png

Thanks again for the help so far

 

@GRedhead apologies but I'm not understanding exactly what you're wanting when comparing the comments to the original issue? Can you provide a bit more detail please?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi, I mean I have a table that has data from today going back to 2014 for opportunities which I want to represent as follows, showing the number of records counting up from 0 through the year, I am unsure how to do this when it's all in one table.

 

GRedhead_0-1644098947150.png

 

Put the Date column as the X Axis on your chart, nor the Month column. Then drag the new column you created as the legend. Then drag the new column on to the Y Axis as well. Hopefully that gives you what you are trying to get to?

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

@GRedhead did you try to put the Date column as the X Axis on your chart, not the Month column. Then drag the new column you created as the legend. Then drag the new column on to the Y Axis as well. Hopefully that gives you what you are trying to get to (you can use the new column as the Legend too in order to split the lines).

 

Make sure that you set the X Axis to "Continuous" like below.  

 

TheoC_0-1644362281226.png

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi, when i try this i get the follwoing 

GRedhead_0-1645905742460.png


i want it to look like this

GRedhead_1-1645905773679.png

It's really stating to annoy me now. 😞 any additonal advice you can provide is apprecaited.



@GRedhead you need to put Month Name on X Axis and YEAR in the Legend field. Hope this helps! Theo 😃

 

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

Hi, when i try that i get the following

GRedhead_0-1645913712509.png

 

How can i get it to start each year at 0 and count the records going up each month through the year? as per the image i posted previously sorry? apologies not sure i was explaining myself properly.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors