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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
vjnvinod
Impactful Individual
Impactful Individual

Dax Logic Help for cumulative on Card

 

problem statement: my actuals. measure in the table shows cumulative value, but when i place the same measure on the card, i get that individual value of the month, as you can see in Feb its 50M as cumulative value and in card it shows as 32M

 

this is my measure for cumulative value

Actual. =
IF([Actuals]>0,
CALCULATE(
    [Actuals],
    FILTER(
        ALLSELECTED('GroupOPEXCAPEX'),
        'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
        'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
    )),BLANK()
)

 

this is my measure for month on month Actuals

Actuals =
IF(
    ISBLANK(
        CALCULATE(SUM('GroupOPEXCAPEX'[Value]), 'GroupOPEXCAPEX'[Actual/Budget] = "Actuals")
    ),
    0,  // Return 0 if blank
    CALCULATE(SUM('GroupOPEXCAPEX'[Value]), 'GroupOPEXCAPEX'[Actual/Budget] = "Actuals")  // Otherwise, return the sum
)

vjnvinod_0-1733720110647.png

 

1 ACCEPTED SOLUTION
AnkitaaMishra
Super User
Super User

Hi @vjnvinod , I tried to replicate your problem statement and below formula is working for me. 

Just change the ALLSELECTED to ALL in your case.

IF([Actuals]>0,
CALCULATE(
    [Actuals],
        ALL('GroupOPEXCAPEX'),
        'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
        'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
    ),BLANK()
)
WhatsApp Image 2024-12-09 at 4.07.43 PM.jpeg

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

Hi, @vjnvinod 

 

As @AnkitaaMishra  said, you can try the following formula.

Actual. = 
IF([Actuals]>0,
 CALCULATE([Actuals],
    FILTER( ALL('GroupOPEXCAPEX'),
        'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
        'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
    )),BLANK()
)

vzhangtinmsft_0-1733809008891.png

Is this the result you expected?

 

Best Regards,

Community Support Team _Charlotte

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

AnkitaaMishra
Super User
Super User

Hi @vjnvinod , I tried to replicate your problem statement and below formula is working for me. 

Just change the ALLSELECTED to ALL in your case.

IF([Actuals]>0,
CALCULATE(
    [Actuals],
        ALL('GroupOPEXCAPEX'),
        'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
        'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
    ),BLANK()
)
WhatsApp Image 2024-12-09 at 4.07.43 PM.jpeg
Sergii24
Super User
Super User

Hi @vjnvinod, I believe that the complexity of your case comes from the use of ALLSELECTED as a table function

Actual. =
IF([Actuals]>0,
CALCULATE(
[Actuals],
FILTER(
ALLSELECTED('GroupOPEXCAPEX'), //<------THE ISSUE IS HERE
'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
)),BLANK()
)
 
In this video, SQLBI team explains why it's tricky and provides a good guildelines on how to use it - https://youtu.be/gD8yLTtyW1k?si=MMi05sR9PjfBV78u.
 
You don't need ALLSELECTED() to get a cummulative totals. Simply get the current max date as variable and then use it in Calculate():

Actual. =
VAR _MaxDate = MAX ('DateTable'[Date]) //MAKE SURE TO HAVE A PROPER DATE TABLE IN YOUR MODEL
RETURN
IF(
[Actuals] > 0,
CALCULATE(
[Actuals],
'DateTable'[Date]<= _MaxDate,
'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
),
BLANK()
)


This should help 🙂

anmolmalviya05
Super User
Super User

Hi @vjnvinod, Please try this:

Total Cumulative Value =
CALCULATE(
SUMX(
ALLSELECTED('GroupOPEXCAPEX'[DateColumn]),
[Actuals]
),
'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
)

@anmolmalviya05 

it doesn't work either

vjnvinod_0-1733726924835.png

 

govind_021
Responsive Resident
Responsive Resident

Hey , @vjnvinod please try this

Actuals Combined =
IF(
ISINSCOPE('GroupOPEXCAPEX'[DateColumn]),
-- Cumulative logic for table rows
IF(
[Actuals] > 0,
CALCULATE(
[Actuals],
FILTER(
ALLSELECTED('GroupOPEXCAPEX'),
'GroupOPEXCAPEX'[DateColumn] <= MAX('GroupOPEXCAPEX'[DateColumn]) &&
'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
)
),
BLANK()
),
-- Monthly value for card or other non-date visuals
CALCULATE(
SUM('GroupOPEXCAPEX'[Value]),
'GroupOPEXCAPEX'[Actual/Budget] = "Actuals"
)
)

vjnvinod
Impactful Individual
Impactful Individual

@govind_021  its returning me month on month values, not cumulative on the card

 

vjnvinod_0-1733726783112.png

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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