cancel
Showing results for
Did you mean:

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper III

## SUMX ADDCOLUMN SUMMARIZE Measure when using a card visual

Hello everyone,

I'm having a very difficult time understanding this problem:

first, I created a measure to calculate the Revenue of previous month and wanted to put this in a Card Visual. It returned BLANK. Here's the measure I used for it:

Test Revenue = CALCULATE(
SUM('Table'[Revenue]), PREVIOUSMONTH('Calendar'[Date])
)

When I put it in a table with a date column, it worked, but no total (hence the BLANK in Card Visual)

After searching the internet, I found this site explaining perfectly:

https://forum.enterprisedna.co/t/mtd-value-is-showing-blank-in-card/19858/2

So now my Test Revenue measure is:

test Revenue =

SUMMARIZE (
'Daily Countries','Daily Countries'[revenue]),
"@actualrevenue", [revenue]
),
[@revenue]
)

When I used it, I got BLANK as well. Then I removed the PREVIOUSMMONTH filter from the calculation, and it returned a value. However, this is what it returned (in the table below). The test Revenue is the measure and the revenue is simply the column from the original table.

And I'm just lost why would the test Revenue show 24,22 + only one of 5,09 and not the 3 of them. Becaus eof the Summarize?

I'm really lost at his point, so I'd be happy about any explanation. Thank you in advance.

2 ACCEPTED SOLUTIONS
Super User

Hi @S3
Because you are summarizing by the same column that you are summing. This summary table will contain only 3 rows: 24.22 ; 5.09 ; 0.00 and those are the numbers that need to be summed.
you can use

``````test Revenue =
SUMX (
VALUES ( 'Calendar'[Month] ),
CALCULATE (
SUM ( 'Daily Countries'[actual_revenue] ),
PREVIOUSMONTH ( 'Calendar'[Date] )
)
)``````
Super User

You may try

``````test Revenue =
SUMX (
LASTNONBLANK ( 'Dates'[Monthid], SUM ( 'Daily Countries'[revenue] ) ),
CALCULATE (
SUM ( 'Daily Countries'[revenue] ),
PREVIOUSMONTH ( 'Dates'[Date] )
)
)``````
5 REPLIES 5
Super User

Hi @S3
Because you are summarizing by the same column that you are summing. This summary table will contain only 3 rows: 24.22 ; 5.09 ; 0.00 and those are the numbers that need to be summed.
you can use

``````test Revenue =
SUMX (
VALUES ( 'Calendar'[Month] ),
CALCULATE (
SUM ( 'Daily Countries'[actual_revenue] ),
PREVIOUSMONTH ( 'Calendar'[Date] )
)
)``````
Helper III

Hello again 🙂

I have a question regarding this measure please: when I put it in the table, it shows the previous month perfectly, but I now would like to put it in a card and it gives me the total of course.

I tried another previous month measure, which works on the card visual showing previous month, but doesn't change when I filter out months. It also doesn't show row by row when put in a table.

The image below explains everyting. Ideally, I would like your measure (test revenue) to act like my measure of Revenue This Month: shoing row by row and at the end showing only for this month (in the test revenue case, only for past month)

Here is the measure I have for Revenue This Month:

Revenue This Month =
VAR LastDateWithData =
LASTNONBLANK ( 'Dates'[Monthid], SUM('Daily Countries'[revenue] ))

Return
CALCULATE(
SUMX (
SUMMARIZE (
'Dates',
'Dates'[Monthid],
"@Currentmonthrevenue", SUM('Daily Countries'[revenue])
),
[@Currentmonthrevenue]
),LastDateWithData )

I really appreciate the help!

Super User

You may try

``````test Revenue =
SUMX (
LASTNONBLANK ( 'Dates'[Monthid], SUM ( 'Daily Countries'[revenue] ) ),
CALCULATE (
SUM ( 'Daily Countries'[revenue] ),
PREVIOUSMONTH ( 'Dates'[Date] )
)
)``````
Helper III

It works, thank you so much!

Helper III

thank youu