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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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