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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
KasRotodyne
Frequent Visitor

Cumulatieve SPEND over a year HELP

Spend = CALCULATE (
    SUM (T_PurInvoiceMain[BasicCurrNetPrice_FactuurLeverancier]  ),
    FILTER (
        ALLSELECTED ( T_PurInvoiceMain ),
        T_PurInvoiceMain[Processed YEAR] <= MAX ( T_PurInvoiceMain[Processed YEAR] )
            && MIN (T_PurInvoiceMain[Processed YEAR]) <= TODAY ()))
 
 
It does not work, please help me has taken already 2 days effectivley with trying.
1 ACCEPTED SOLUTION
v-henryk-mstf
Community Support
Community Support

Hi @KasRotodyne ,

 

According to the formula you provided, today() gets the current date value instead of the year, you need to convert the formula by year(today()).

Try measure like below:

Spend =
CALCULATE (
    SUM ( T_PurInvoiceMain[BasicCurrNetPrice_FactuurLeverancier] ),
    FILTER (
        ALL ( T_PurInvoiceMain ),
        T_PurInvoiceMain[Processed YEAR] <= MAX ( T_PurInvoiceMain[Processed YEAR] )
            && MIN ( T_PurInvoiceMain[Processed YEAR] ) <= YEAR ( TODAY () )
    )
)

 

If the problem is still not resolved, you need to provide the relevant test data and a screenshot of the desired result, so that I can answer your question as soon as possible. Looking forward to your reply.


Best Regards,
Henry


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-henryk-mstf
Community Support
Community Support

Hi @KasRotodyne ,

 

According to the formula you provided, today() gets the current date value instead of the year, you need to convert the formula by year(today()).

Try measure like below:

Spend =
CALCULATE (
    SUM ( T_PurInvoiceMain[BasicCurrNetPrice_FactuurLeverancier] ),
    FILTER (
        ALL ( T_PurInvoiceMain ),
        T_PurInvoiceMain[Processed YEAR] <= MAX ( T_PurInvoiceMain[Processed YEAR] )
            && MIN ( T_PurInvoiceMain[Processed YEAR] ) <= YEAR ( TODAY () )
    )
)

 

If the problem is still not resolved, you need to provide the relevant test data and a screenshot of the desired result, so that I can answer your question as soon as possible. Looking forward to your reply.


Best Regards,
Henry


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

amitchandak
Super User
Super User

@KasRotodyne , Try like

if year not date

 

Spend = CALCULATE (
SUM (T_PurInvoiceMain[BasicCurrNetPrice_FactuurLeverancier] ),
FILTER (
ALLSELECTED ( T_PurInvoiceMain ),
T_PurInvoiceMain[Processed YEAR] <= MAX ( T_PurInvoiceMain[Processed YEAR] )
&& (T_PurInvoiceMain[Processed YEAR]) <= year(TODAY ())))

 

 

id year column is a date

 

 

Spend = CALCULATE (
SUM (T_PurInvoiceMain[BasicCurrNetPrice_FactuurLeverancier] ),
FILTER (
ALLSELECTED ( T_PurInvoiceMain ),
T_PurInvoiceMain[Processed YEAR] <= MAX ( T_PurInvoiceMain[Processed YEAR] )
&& (T_PurInvoiceMain[Processed YEAR]) <= (TODAY ())))

@amitchandak 

 

Nope 

KasRotodyne_0-1659091878121.png

 

It still wont work. I have tried multiple ways and everytime it seems to work with other but not here. 

 

#Error or the sum of all spend is what the funtion returns.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.