Reply
Orstenpowers
Post Patron
Post Patron
Partially syndicated - Outbound

Cumulated YTD figures with Year-Calendar week???

Hi everybody!

My table looks as follows. Now I would like to add a column that illustrates the cumulated values since beginning of the year, based on the VEAR-CW (--> YEAR-CW = FORMAT('Date'[Date],"YYYY") & "-" & FORMAT(WEEKNUM('Date'[Date],21),"00")

).

As an example, I would like to get following results

2024-01   22.364.041,96

2024-02   67.539.975,34

2024-03   112.623.836,05

 

I tried it with the Quickmeasure provided by PBI Desktop, but that did not work...

PBI_Comm_009.JPG

 

Anybody here who could help me?

1 ACCEPTED SOLUTION

Syndicated - Outbound

Hi @Orstenpowers ,

Replace 'year' in the expression:

Rank = 
var _a = 'Table'[YEAR]
RETURN IF(
    _a = YEAR(TODAY()),
    RANKX(FILTER(ALL('Table'),'Table'[YEAR] = YEAR(TODAY())),'Table'[YEAR-CW],,ASC,Dense),
     RANKX(FILTER(ALL('Table'),'Table'[YEAR] = YEAR(TODAY()) - 1),'Table'[YEAR-CW],,ASC,Dense)
    )
Cumulative value = IF('Table'[YEAR] = YEAR(TODAY()),
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = YEAR(TODAY()))),
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = YEAR(TODAY()) - 1)))

 

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

View solution in original post

3 REPLIES 3
v-zhouwen-msft
Community Support
Community Support

Syndicated - Outbound

Hi @Orstenpowers ,

The Table data is shown below:

vzhouwenmsft_0-1710408747518.png

Please follow these steps:
1. Use the following DAX expression to create a column named ‘Rank’

Rank = 
var _a = 'Table'[YEAR]
RETURN IF(
    _a = 2024,
    RANKX(FILTER(ALL('Table'),'Table'[YEAR] = 2024),'Table'[YEAR-CW],,ASC,Dense),
     RANKX(FILTER(ALL('Table'),'Table'[YEAR] = 2023),'Table'[YEAR-CW],,ASC,Dense)
    )

2. Use the following DAX expression to create a column named ‘Cumulative value’

Cumulative value = IF('Table'[YEAR] = 2024,
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = 2024)),
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = 2023)))

3. Final output

vzhouwenmsft_1-1710408852744.png

 

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

Syndicated - Outbound

Thank you very much for your reply!

Is it possible to adjust the formula, making it needless to write the years? "Recognizing" the year automatically?

Looking forward to your feedback I remain

Syndicated - Outbound

Hi @Orstenpowers ,

Replace 'year' in the expression:

Rank = 
var _a = 'Table'[YEAR]
RETURN IF(
    _a = YEAR(TODAY()),
    RANKX(FILTER(ALL('Table'),'Table'[YEAR] = YEAR(TODAY())),'Table'[YEAR-CW],,ASC,Dense),
     RANKX(FILTER(ALL('Table'),'Table'[YEAR] = YEAR(TODAY()) - 1),'Table'[YEAR-CW],,ASC,Dense)
    )
Cumulative value = IF('Table'[YEAR] = YEAR(TODAY()),
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = YEAR(TODAY()))),
'Table'[Total Amount(Base)] +CALCULATE(SUM('Table'[Total Amount(Base)]),FILTER(ALL('Table'),'Table'[Rank] <EARLIER('Table'[Rank]) && 'Table'[YEAR] = YEAR(TODAY()) - 1)))

 

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

avatar user

Helpful resources

Announcements
Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)