Forum Discussion
How to make Line Chart stop mid-graph for future weeks
Hi,
I've made a line chart, showcasing the accumultion of received applications throughout the weeks of 2022 compared to 2021.
The dataline for 2022, do not have values/data for future weeks and I'd like the line for 2022 to stop mid-graph at the current weeknumber. But, I can't figure out how to.
This is my current graph:
Measure for accumulatation current year
This is a data sample
| DateOfApplication | Studystartdate | Received Week Number | Year of Application | Year of Studystart |
| 05-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 05-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 05-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 02-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 31-01-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 16-12-2021 | 31-07-2022 | 50 | 2021 | 2022 |
| 26-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 25-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 25-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 25-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 22-11-2021 | 31-07-2022 | 47 | 2021 | 2022 |
| 22-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 22-11-2021 | 10-01-2022 | 47 | 2021 | 2022 |
| 17-11-2021 | 10-01-2022 | 46 | 2021 | 2022 |
| 15-11-2021 | 10-01-2022 | 46 | 2021 | 2022 |
| 14-11-2021 | 10-01-2022 | 45 | 2021 | 2022 |
| 09-11-2021 | 10-01-2022 | 45 | 2021 | 2022 |
| 02-11-2021 | 10-01-2022 | 44 | 2021 | 2022 |
| 31-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 29-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 29-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 25-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 25-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 25-10-2021 | 10-01-2022 | 43 | 2021 | 2022 |
| 09-10-2021 | 10-01-2022 | 40 | 2021 | 2022 |
| 08-10-2021 | 10-01-2022 | 40 | 2021 | 2022 |
| 04-10-2021 | 10-01-2022 | 40 | 2021 | 2022 |
| 02-10-2021 | 10-01-2022 | 39 | 2021 | 2022 |
| 02-10-2021 | 10-01-2022 | 39 | 2021 | 2022 |
| 15-09-2021 | 31-07-2022 | 37 | 2021 | 2022 |
| 09-09-2021 | 10-01-2022 | 36 | 2021 | 2022 |
| 23-08-2021 | 10-01-2022 | 34 | 2021 | 2022 |
| 18-08-2021 | 10-01-2022 | 33 | 2021 | 2022 |
| 17-08-2021 | 10-01-2022 | 33 | 2021 | 2022 |
| 17-08-2021 | 10-01-2022 | 33 | 2021 | 2022 |
| 06-08-2021 | 31-07-2022 | 31 | 2021 | 2022 |
| 04-07-2021 | 10-01-2022 | 26 | 2021 | 2022 |
| 28-05-2021 | 10-01-2022 | 21 | 2021 | 2022 |
| 26-05-2021 | 10-01-2022 | 21 | 2021 | 2022 |
| 20-05-2021 | 10-01-2022 | 20 | 2021 | 2022 |
| 25-03-2021 | 10-01-2022 | 12 | 2021 | 2022 |
| 18-02-2021 | 31-07-2022 | 7 | 2021 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 04-08-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 04-08-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 30-03-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 08-08-2022 | 6 | 2022 | 2022 |
| 04-02-2022 | 08-08-2022 | 5 | 2022 | 2022 |
| 07-02-2022 | 08-08-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 08-08-2022 | 6 | 2022 | 2022 |
| 07-02-2022 | 08-08-2022 | 6 | 2022 | 2022 |
| 06-02-2022 | 30-03-2022 | 5 | 2022 | 2022 |
| 06-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
| 06-02-2022 | 30-03-2022 | 5 | 2022 | 2022 |
| 06-02-2022 | 04-08-2022 | 5 | 2022 | 2022 |
Thanks in advance 😃
Hi Anonymous
What you want to do is compare the current (or possibly last) week number available in the data to the week number in the axis - use MAX(WeekNumber). If the week number in the axis > current/last available in data then BLANK() otherwise show value.
Hope this helps!
3 Replies
- littlemojopuppyCommunity Champion
Hi Anonymous
What you want to do is compare the current (or possibly last) week number available in the data to the week number in the axis - use MAX(WeekNumber). If the week number in the axis > current/last available in data then BLANK() otherwise show value.
Hope this helps!
- AnonymousNot applicable
Hi Anonymous ,
How does 'Final_data'[ISOWeekNum] come from?
Does your calendar table have a relationship with the main table?
Your image is not clear enough, I can't see the specific content in Fields.When publishing, you can enlarge the size of your image.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
Hi,
'Final_data'[ISOWeekNum]= if(and(Final_data[Received Week Number]>51,month(Final_data[DateOfApplication])=1),1,Final_data[Received Week Number])to handle whenever week 52 or 53 ends in a new year.I'have not linked the calendar table directedly to the main table, but I'm using the calendar as my date table.I have suceeded in making the line chart stop mid graph implementing the following codeCurrentY(Accumulated+PrevYear) =IF(MAX('Calendar'[ISOWeekNum])>=WEEKNUM(MAX(Final_data[DateOfApplication]),2),Blank(),VAR CurrentWeek_ =MAX ( 'Calendar'[ISOWeekNum] )VAR StudyYear = YEAR(TODAY())VAR AppYear = YEAR(TODAY())VAR PrevAppYear = StudyYear-1VAR PrevYFinal =CALCULATE(COUNTROWS ( 'Final_data' ), Final_data[Year of Studystart] = StudyYear, Final_data[Year of Application] = PrevAppYear)Var AccumCY=CALCULATE (COUNTROWS ( 'Final_data' ),'Final_data'[ISOWeekNum] <= CurrentWeek_,'Final_data'[Year of Studystart] = StudyYear,'Final_data'[Year of Application]=AppYear)ReturnAccumCY+PrevYFinal)