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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply
Anonymous
Not applicable

Calculating total in a card with filters

Hi everyone!

Looking for help in the following issue 🙂

In my report I have a matrix that shows different calculations -one of them is "Up Sale amount". 

(It is important to mention that this matrix is affected by filters that I added as well).

What I want is to add a card to the report with the "Up Sale amount" measure, but the problem is that I get another result as not all filters are working in the card. 

This is the measure in a matrix: 

 

KatyaK_4-1633425423222.png

 

And this is what I get in the card:

KatyaK_3-1633425378809.png

 

 

So I created the following meaure : 

upsale amount filtered for =
VAR __DS0FilterTable =
TREATAS({3}, 'Dim_Employees'[ID_Employee_Function])

VAR __DS0FilterTable2 =
FILTER(
KEEPFILTERS(VALUES('Dim_Employees'[ID_Full_EMP_Name])),
NOT(ISBLANK('Dim_Employees'[ID_Full_EMP_Name]))
)

VAR __DS0FilterTable3 =
FILTER(
KEEPFILTERS(VALUES('Dim_Customers'[ID_Customer_Name])),
NOT(ISBLANK('Dim_Customers'[ID_Customer_Name]))
)

VAR __ValueFilterDM3 =
FILTER(
KEEPFILTERS(
SUMMARIZECOLUMNS(
'Dim_Employees'[ID_Full_EMP_Name],
'Dim_Customers'[Customer_Name],
__DS0FilterTable,
__DS0FilterTable2,
__DS0FilterTable3,
"SumUpsale_Amount", CALCULATE(SUM('vwbi_order'[Upsale_Amount])),
"Total_Unique_Customers", IGNORE('Measures For Calls Reports'[Total Unique Customers]),
"SumAmount_Defacto", IGNORE(CALCULATE(SUM('vwbi_order'[Amount_Defacto])))
)
),
AND(
NOT(ISBLANK([Total_Unique_Customers])),
NOT(ISBLANK([SumAmount_Defacto]))
)
)

VAR __DS0Core =
SUMMARIZECOLUMNS(
__DS0FilterTable,
__DS0FilterTable2,
__DS0FilterTable3,
__ValueFilterDM3,
"@SumUpsale_Amount", CALCULATE([Total Upsale Amount])
)

RETURN
SUMX(
__DS0Core,
[@SumUpsale_Amount])
 
But the measure returns an error: 
KatyaK_0-1633425091311.png

 

Do you know how can I fix this? 

14 REPLIES 14
v-janeyg-msft
Community Support
Community Support

@Anonymous  Any updates?

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If problem still persists, pls let me know.

 

Best Regards,

Community Support Team _ Janey

v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

The context of matrix is much more complicated than that of card, and your measure is also very complicated, leading to problems. I think the fastest way is to re-write a 'total' in card according to your logic instead of using the measure in the matrix. 

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.


Best Regards,

Community Support Team _ Janey

 

HotChilli
Super User
Super User

It looks like you've copied the DAX generated for the matrix visual (and maybe edited it as well).  I don't think this is a good way to continue.

There will be a simpler way to write a measure to get the value on a card.

I suppose you have to work out why there is a difference between the 437m and 443m. You say "not all filters are working in the card" - why is that?  and what does the total upsale measure look like?

Anonymous
Not applicable

Hi 🙂

 

The measure is very simple - I aggregated a column with sum function. 

But the issue that I added 2 filters on the matrix that led to different total amount in the measure, So I want to add those filters to the card in order to get same result. 

As I can't add the filters to the card itself I try to create a measure which will do it, but today I have problem with that as it doesnt work....

 

This is the measure: 

Total Upsale Amount =
SUM(vwbi_order[Upsale_Amount])
 
The filters that I want to add - 
vwbi_order'[Amount_Defacto] not blank
[Total Unique Customers] not blank
'Dim_Employees'[ID_Full_EMP_Name] not null

 

Hi,

Does this measure work?

=calculate([Total Upsale Amount],filter(values('Dim_Employees'[ID_Full_EMP_Name]),[Total Unique Customers]<>blank()))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

I have spent the last 2 hours looking for this answer. Thanks so much!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi Ashish Mathur!

yes it works!

But I have 3 filters - so I need to add another one from another table - 

vwbi_order'[Amount_Defacto] not blank,

and in the filter function it enables to use column from one table as I understand. 

Do you know how can I add this filter as well? 

Hi, @Anonymous 

 

Try:

measure =
CALCULATE (
    [Total Upsale Amount],
    'Dim_Employees'[ID_Full_EMP_Name] <> BLANK (),
    'vwbi_order'[Amount_Defacto] <> BLANK (),
    [Total Unique Customers] <> BLANK ()
)

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

Anonymous
Not applicable

Hi!

Thank you for your response. 

This is te error I got when I used the query:

 

KatyaK_0-1633956900934.png

 

@Anonymous 

 

Try this:

measure =
CALCULATE (
    [Total Upsale Amount],
    FILTER (
        ALL ( 'Dim_Employees' ),
        'Dim_Employees'[ID_Full_EMP_Name] <> BLANK ()
    ),
    FILTER ( ALL ( 'vwbi_order' ), 'vwbi_order'[Amount_Defacto] <> BLANK () ),
    [Total Unique Customers] <> BLANK ()
)

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.


Best Regards,

Community Support Team _ Janey

Anonymous
Not applicable

Hi !

UnfortunatelyI get same error 😞

KatyaK_0-1634018803561.png

 

@Anonymous 

 

You need to put all conditions in tables. I don’t know what your measure([Total Unique Customers]) is and which table is related to it. 

measure =
CALCULATE (
    [Total Upsale Amount],
    FILTER (
        ALL ( 'Dim_Employees' ),
        'Dim_Employees'[ID_Full_EMP_Name] <> BLANK ()
    ),
    FILTER ( ALL ( 'vwbi_order' ), 'vwbi_order'[Amount_Defacto] <> BLANK () ),
    FILTER ( ALL ( table ),[Total Unique Customers] <> BLANK ()
)

 I don’t know what your data and table look like, this code is just a rough idea.

 

Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please upload some insensitive data samples and expected output.


Best Regards,

Community Support Team _ Janey

Anonymous
Not applicable

'Dim_Employees'[ID_Full_EMP_Name] not blank*****

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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