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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
m4xon
Helper III
Helper III

Line Chart - continuous descending line

Hello,

 

I have following problem, I have a graph with different data, but in addition to this I would like to add a continuous descending line that starts with the sum of the earliest day available and goes down to 0 evenly through the number of weeks available, below data example:

 

Date	Tasks	ID	Week of Year
18/12/2023	103	65000	202351
18/12/2023	68	74000	202351
18/12/2023	133	77000	202351
19/12/2023	104	65000	202351
19/12/2023	69	74000	202351
19/12/2023	133	77000	202351
20/12/2023	69	74000	202351
20/12/2023	134	77000	202351
20/12/2023	103	65000	202351
21/12/2023	70	74000	202351
21/12/2023	134	77000	202351
21/12/2023	104	65000	202351
22/12/2023	70	74000	202351
22/12/2023	134	77000	202351
22/12/2023	104	65000	202351
23/12/2023	70	74000	202351
23/12/2023	134	77000	202351
23/12/2023	104	65000	202351
24/12/2023	70	74000	202351
24/12/2023	134	77000	202351
24/12/2023	104	65000	202351
25/12/2023	70	74000	202352
25/12/2023	134	77000	202352
25/12/2023	104	65000	202352
26/12/2023	70	74000	202352
26/12/2023	134	77000	202352
26/12/2023	104	65000	202352
27/12/2023	70	74000	202352
27/12/2023	134	77000	202352
27/12/2023	103	65000	202352
28/12/2023	70	74000	202352
28/12/2023	134	77000	202352
28/12/2023	104	65000	202352
29/12/2023	70	74000	202352
29/12/2023	134	77000	202352
29/12/2023	104	65000	202352
30/12/2023	70	74000	202352
30/12/2023	134	77000	202352
30/12/2023	104	65000	202352
31/12/2023	70	74000	202352
31/12/2023	134	77000	202352
31/12/2023	104	65000	202352
01/01/2024	70	74000	202401
01/01/2024	134	77000	202401
01/01/2024	104	65000	202401
02/01/2024	88	74000	202401
02/01/2024	134	77000	202401
02/01/2024	104	65000	202401
03/01/2024	59	74000	202401
03/01/2024	134	77000	202401
03/01/2024	104	65000	202401
04/01/2024	73	74000	202401
04/01/2024	134	77000	202401
04/01/2024	104	65000	202401
05/01/2024	73	74000	202401
05/01/2024	134	77000	202401
05/01/2024	95	65000	202401
06/01/2024	73	74000	202401
06/01/2024	134	77000	202401
06/01/2024	95	65000	202401
07/01/2024	73	74000	202401
07/01/2024	134	77000	202401
07/01/2024	95	65000	202401
08/01/2024	73	74000	202402
08/01/2024	134	77000	202402
08/01/2024	95	65000	202402
09/01/2024	73	74000	202402
09/01/2024	135	77000	202402
09/01/2024	95	65000	202402
10/01/2024	79	74000	202402
10/01/2024	135	77000	202402
10/01/2024	90	65000	202402
11/01/2024	79	74000	202402
11/01/2024	135	77000	202402
11/01/2024	89	65000	202402
12/01/2024	82	74000	202402
12/01/2024	134	77000	202402
12/01/2024	88	65000	202402
13/01/2024	82	74000	202402
13/01/2024	134	77000	202402
13/01/2024	88	65000	202402
14/01/2024	82	74000	202402
14/01/2024	134	77000	202402
14/01/2024	88	65000	202402
15/01/2024	81	74000	202403
15/01/2024	138	77000	202403
15/01/2024	85	65000	202403
16/01/2024	136	77000	202403
16/01/2024	82	65000	202403
16/01/2024	81	74000	202403
17/01/2024	130	77000	202403
17/01/2024	81	74000	202403
17/01/2024	81	65000	202403
18/01/2024	130	77000	202403
18/01/2024	81	74000	202403
18/01/2024	80	65000	202403
19/01/2024	130	77000	202403
19/01/2024	81	74000	202403
19/01/2024	80	65000	202403
20/01/2024	130	77000	202403
20/01/2024	81	74000	202403
20/01/2024	80	65000	202403
21/01/2024	130	77000	202403
21/01/2024	81	74000	202403
21/01/2024	80	65000	202403
22/01/2024	130	77000	202404
22/01/2024	85	74000	202404
22/01/2024	80	65000	202404
23/01/2024	130	77000	202404
23/01/2024	85	74000	202404
23/01/2024	80	65000	202404
24/01/2024	85	74000	202404
24/01/2024	80	65000	202404
24/01/2024	125	77000	202404
25/01/2024	80	65000	202404
25/01/2024	126	77000	202404
25/01/2024	88	74000	202404
26/01/2024	88	74000	202404
26/01/2024	80	65000	202404
26/01/2024	125	77000	202404
27/01/2024	88	74000	202404
27/01/2024	80	65000	202404
27/01/2024	125	77000	202404
28/01/2024	88	74000	202404
28/01/2024	80	65000	202404
28/01/2024	125	77000	202404
29/01/2024	81	65000	202405
29/01/2024	88	74000	202405
29/01/2024	124	77000	202405
30/01/2024	81	65000	202405
30/01/2024	88	74000	202405
30/01/2024	125	77000	202405
31/01/2024	81	65000	202405
31/01/2024	88	74000	202405
31/01/2024	125	77000	202405
01/02/2024	81	65000	202405
01/02/2024	88	74000	202405
01/02/2024	125	77000	202405
02/02/2024	88	74000	202405
02/02/2024	125	77000	202405
02/02/2024	80	65000	202405
03/02/2024	88	74000	202405
03/02/2024	80	65000	202405
03/02/2024	125	77000	202405
04/02/2024	88	74000	202405
04/02/2024	80	65000	202405
04/02/2024	125	77000	202405
05/02/2024	79	65000	202406
05/02/2024	125	77000	202406
05/02/2024	85	74000	202406
06/02/2024	79	65000	202406
06/02/2024	86	74000	202406
06/02/2024	123	77000	202406
07/02/2024	79	65000	202406
07/02/2024	86	74000	202406
07/02/2024	123	77000	202406
08/02/2024	79	65000	202406
08/02/2024	86	74000	202406
08/02/2024	124	77000	202406
09/02/2024	79	65000	202406
09/02/2024	86	74000	202406
09/02/2024	124	77000	202406
10/02/2024	79	65000	202406
10/02/2024	86	74000	202406
10/02/2024	124	77000	202406
11/02/2024	79	65000	202406
11/02/2024	86	74000	202406
11/02/2024	124	77000	202406
12/02/2024	86	74000	202407
12/02/2024	78	65000	202407
12/02/2024	119	77000	202407
13/02/2024	78	65000	202407
13/02/2024	86	74000	202407
13/02/2024	116	77000	202407
14/02/2024	77	65000	202407
14/02/2024	116	77000	202407
14/02/2024	79	74000	202407
15/02/2024	116	77000	202407
15/02/2024	80	74000	202407
15/02/2024	76	65000	202407
16/02/2024	78	65000	202407
16/02/2024	116	77000	202407
16/02/2024	79	74000	202407
17/02/2024	78	65000	202407
17/02/2024	116	77000	202407
17/02/2024	79	74000	202407
18/02/2024	78	65000	202407
18/02/2024	116	77000	202407
18/02/2024	79	74000	202407
19/02/2024	78	65000	202408
19/02/2024	81	74000	202408
19/02/2024	114	77000	202408
20/02/2024	74	65000	202408
20/02/2024	82	74000	202408
20/02/2024	110	77000	202408
21/02/2024	74	65000	202408
21/02/2024	110	77000	202408
21/02/2024	82	74000	202408
22/02/2024	110	77000	202408
22/02/2024	81	74000	202408
22/02/2024	72	65000	202408
23/02/2024	72	65000	202408
23/02/2024	109	77000	202408
23/02/2024	87	74000	202408
24/02/2024	72	65000	202408
24/02/2024	109	77000	202408
24/02/2024	87	74000	202408
25/02/2024	72	65000	202408
25/02/2024	109	77000	202408
25/02/2024	87	74000	202408
26/02/2024	73	65000	202409
26/02/2024	87	74000	202409
26/02/2024	107	77000	202409
27/02/2024	88	74000	202409
27/02/2024	106	77000	202409
27/02/2024	70	65000	202409
28/02/2024	106	77000	202409
28/02/2024	88	74000	202409
28/02/2024	68	65000	202409
29/02/2024	68	65000	202409
29/02/2024	88	74000	202409
29/02/2024	104	77000	202409
01/03/2024	68	65000	202409
01/03/2024	88	74000	202409
01/03/2024	103	77000	202409
02/03/2024	68	65000	202409
02/03/2024	103	77000	202409
02/03/2024	88	74000	202409
03/03/2024	68	65000	202409
03/03/2024	103	77000	202409
03/03/2024	88	74000	202409
04/03/2024	69	65000	202410
04/03/2024	88	74000	202410
04/03/2024	102	77000	202410
05/03/2024	69	65000	202410
05/03/2024	103	77000	202410
05/03/2024	88	74000	202410
06/03/2024	88	74000	202410
06/03/2024	68	65000	202410
06/03/2024	98	77000	202410
07/03/2024	98	77000	202410
07/03/2024	88	74000	202410
07/03/2024	67	65000	202410
08/03/2024	88	74000	202410
08/03/2024	66	65000	202410
08/03/2024	97	77000	202410
09/03/2024	66	65000	202410
09/03/2024	97	77000	202410
09/03/2024	88	74000	202410
10/03/2024	66	65000	202410
10/03/2024	97	77000	202410
10/03/2024	88	74000	202410
11/03/2024	89	74000	202411
11/03/2024	65	65000	202411
11/03/2024	92	77000	202411
12/03/2024	91	77000	202411
12/03/2024	64	65000	202411
12/03/2024	83	74000	202411
13/03/2024	91	77000	202411
13/03/2024	60	65000	202411
13/03/2024	75	74000	202411
14/03/2024	60	65000	202411
14/03/2024	90	77000	202411
14/03/2024	75	74000	202411
15/03/2024	60	65000	202411
15/03/2024	75	74000	202411
15/03/2024	82	77000	202411
16/03/2024	60	65000	202411
16/03/2024	82	77000	202411
16/03/2024	75	74000	202411
17/03/2024	60	65000	202411
17/03/2024	82	77000	202411
17/03/2024	76	74000	202411
18/03/2024	60	65000	202412
18/03/2024	76	74000	202412
18/03/2024	60	77000	202412
19/03/2024	76	74000	202412
19/03/2024	58	65000	202412
19/03/2024	57	77000	202412
20/03/2024		65000	202412
20/03/2024		74000	202412
20/03/2024		77000	202412
21/03/2024		65000	202412
21/03/2024		74000	202412
21/03/2024		77000	202412
22/03/2024		65000	202412
22/03/2024		74000	202412
22/03/2024		77000	202412
23/03/2024		65000	202412
23/03/2024		74000	202412
23/03/2024		77000	202412
24/03/2024		65000	202412
24/03/2024		74000	202412
24/03/2024		77000	202412

 

 

Thank you in advance

Max

6 REPLIES 6
v-jianpeng-msft
Community Support
Community Support

Hi, @m4xon 

Based on your description, and the data provided, I use the following sample data:

vjianpengmsft_0-1711086695459.png

First, I used the following DAX to extract the current number of weeks:

 

Week = RIGHT('Table'[Week of Year],2) 

 

vjianpengmsft_1-1711089870664.png

 

Accumulation =
CALCULATE (
    SUM ( 'Table'[Tasks] ),
    FILTER (
        'Table',
        'Table'[Date] <= EARLIER ( 'Table'[Date] )
            && 'Table'[ID] = EARLIER ( 'Table'[ID] )
    )
)

 

vjianpengmsft_0-1711091312629.png

Maxtotaltask1 =
CALCULATE (
    MAX ( [Accumulation] ),
    FILTER ( 'Table', 'Table'[ID] = EARLIER ( 'Table'[ID] ) )
)

vjianpengmsft_1-1711091372249.png

Weekback1 = [Week]
rank1 = 
RANKX(FILTER('Table','Table'[ID]=EARLIER('Table'[ID])),[Week],,DESC,Dense)

Sort by column select rank1:

vjianpengmsft_2-1711091561059.png

I use the following measure to create a descending curve:

Descending Line =
VAR _week =
    SELECTEDVALUE ( 'Table'[Weekback1] )
VAR _be =
    CALCULATE (
        SUM ( 'Table'[Tasks] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Week] >= _week )
    )
RETURN
    MAX ( 'Table'[Maxtotaltask1] ) - _be

The results are shown in the figure below:

vjianpengmsft_3-1711092232067.png

vjianpengmsft_4-1711092246462.png

I have provided the PBIX file used this time below, I hope it can help you.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

Thank you very much, but what if I want the line to descend evenly, i.e. take the sum of the first date values and then divide by the number of weeks to come down to 0 equally

Hi, @m4xon 

Thank you very much for your reply, can you elaborate on what the total value of the first date means?

 

 

Best Regards

Jianpeng Li

Hello @v-jianpeng-msft
the first date or the lowest date in our set should be the starting point of our line, i.e. for example for ID 65000 it would be 103 and from 103 we should evenly reach 0 for all available weeks

Hi,  @m4xon 

Thank you very much for your reply. I use the following DAX to find the weekly task:

Perweektask =
VAR _minday =
    CALCULATE ( MIN ( 'Table 2'[minday] ) )
VAR _mintasks =
    CALCULATE (
        MIN ( 'Table'[Tasks] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] = _minday )
    )
VAR _counts =
    CALCULATE ( DISTINCTCOUNT ( 'Table'[Week] ), ALLSELECTED ( 'Table' ) )
VAR _perweekdecending =
    DIVIDE ( _mintasks, _counts )
RETURN
    _perweekdecending

Use the following DAX for the task corresponding to the smallest date:

Mintask =
VAR _minday =
    CALCULATE ( MIN ( 'Table 2'[minday] ) )
VAR _mintasks =
    CALCULATE (
        MIN ( 'Table'[Tasks] ),
        FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] = _minday )
    )
RETURN
    _mintasks

I used the following DAX to get a curve of uniform decline:

Descending Line1 =
VAR _week =
    SELECTEDVALUE ( 'Table'[Weekback1] )
VAR _nums =
    CALCULATE (
        DISTINCTCOUNT ( 'Table'[Weekback1] ),
        FILTER ( ALLEXCEPT ( 'Table', 'Table'[ID] ), 'Table'[Weekback1] > _week )
    ) + 1
RETURN
    [Mintask] - [Perweektask] * _nums

Here are the results:

vjianpengmsft_2-1711618912385.png

vjianpengmsft_3-1711618925796.png

 

I've provided the PBIX file for this time below, and it would be great if I could help you.

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

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

 

 

 

Thank you @v-jianpeng-msft for your time, it's almost fine, only the weeks aren't in sequence (should be 51, 52, 01, 02 ... ), I tried instead of RIGHT use the whole YearWeek, but I guess that we have to do it somehow differently... 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.