Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hi Team,
I have 700 rows of data which is basically date column, I have to create a new column where it gives output as 1 for 1st 7 rows and followed by 2 for next 7 rows and goes on till 52 and after that it should again start from 1.
Thanks
Solved! Go to Solution.
@raassd Sorry, missed that. This should work:
WeekNum =
VAR __Count = COUNTROWS( FILTER( 'Dates', [Date] <= EARLIER( 'Dates'[Date] ) ) )
VAR __Num = INT( DIVIDE( __Count , 7 ) )
VAR __WeekNum = IF( MOD( __Count, 7 ) = 0, __Num, __Num + 1 )
VAR __Result = IF( __WeekNum > 52, __WeekNum - 52 * ( INT( DIVIDE( __WeekNum, 52 ) ) ), __WeekNum )
RETURN
__Result
@raassd Try this:
WeekNum =
VAR __Count = COUNTROWS( FILTER( 'Dates', [Date] <= EARLIER( 'Dates'[Date] ) ) )
VAR __Num = INT( DIVIDE( __Count , 7 ) )
VAR __Result = IF( MOD( __Count, 7 ) = 0, __Num, __Num + 1 )
RETURN
__Result
Thanks for the response !
Here is my output, I am getting 53 and 54 so but my requirment is after 52 it should start again from 1.
Thanks again!
@raassd Sorry, missed that. This should work:
WeekNum =
VAR __Count = COUNTROWS( FILTER( 'Dates', [Date] <= EARLIER( 'Dates'[Date] ) ) )
VAR __Num = INT( DIVIDE( __Count , 7 ) )
VAR __WeekNum = IF( MOD( __Count, 7 ) = 0, __Num, __Num + 1 )
VAR __Result = IF( __WeekNum > 52, __WeekNum - 52 * ( INT( DIVIDE( __WeekNum, 52 ) ) ), __WeekNum )
RETURN
__Result
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
70 | |
55 | |
37 | |
31 |
User | Count |
---|---|
83 | |
64 | |
63 | |
49 | |
45 |