March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
As you can see I have 3 cards showing SUM of measure from different tables and the last one is a SUM for both:
Total Advisory = sum(Advisory[AUM])
Total NET XP = SUM('Historico Diversificador Web'[NET])
Total Advisory + XP = [Total Advisory] + [Total NET XP]
If no date range is selected the cards will show a SUM for the whole period which is not what we want since this is historical evolution data not cumulative.
These data sets are coming from different people and as you can see we still havent received the data for December and January from the Total Advisory table.
What I am trying to do is have the cards show data for the previous available month when nothing on the page is selected and have it show the selection when a chart date is selected.
Solved! Go to Solution.
Hi @diogodasilva ,
I think your data model should be a DimDate table and a Fact table. DimDate table andFact table is connected by [Date] columns. You can try PREVIOUSMONTH function. Please try below code.
Total Advisory =
VAR _CURRENT =
CALCULATE ( SUM ( Advisory[AUM] ) )
VAR _PREVIOUS =
CALCULATE ( SUM ( Advisory[AUM] ), PREVIOUSMONTH ( DimDate[Date] ) )
RETURN
IF ( ISFILTERED ( DimDate[Date] ), _CURRENT, _PREVIOUS )
Total NET XP = SUM('Historico Diversificador Web'[NET])
Total Advisory =
VAR _CURRENT =
CALCULATE ( SUM('Historico Diversificador Web'[NET]) )
VAR _PREVIOUS =
CALCULATE ( SUM('Historico Diversificador Web'[NET]), PREVIOUSMONTH ( DimDate[Date] ) )
RETURN
IF ( ISFILTERED ( DimDate[Date] ), _CURRENT, _PREVIOUS )
Total Advisory + XP = [Total Advisory] + [Total NET XP]
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @diogodasilva ,
I think your data model should be a DimDate table and a Fact table. DimDate table andFact table is connected by [Date] columns. You can try PREVIOUSMONTH function. Please try below code.
Total Advisory =
VAR _CURRENT =
CALCULATE ( SUM ( Advisory[AUM] ) )
VAR _PREVIOUS =
CALCULATE ( SUM ( Advisory[AUM] ), PREVIOUSMONTH ( DimDate[Date] ) )
RETURN
IF ( ISFILTERED ( DimDate[Date] ), _CURRENT, _PREVIOUS )
Total NET XP = SUM('Historico Diversificador Web'[NET])
Total Advisory =
VAR _CURRENT =
CALCULATE ( SUM('Historico Diversificador Web'[NET]) )
VAR _PREVIOUS =
CALCULATE ( SUM('Historico Diversificador Web'[NET]), PREVIOUSMONTH ( DimDate[Date] ) )
RETURN
IF ( ISFILTERED ( DimDate[Date] ), _CURRENT, _PREVIOUS )
Total Advisory + XP = [Total Advisory] + [Total NET XP]
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hey @diogodasilva,
I'm not exactly sure what your data model looks like and what your tables and columns are called. Perhaps this formula will help you further. You still have to adjust the correct references to tables and columns.
Total Advisory =
IF (
ISFILTERED ( 'Table'[YearMonth] ),
SUM ( Advisory[AUM] ),
VAR _last_month =
LASTNONBLANKVALUE (
'Table'[YearMonthOrder],
CALCULATE ( SUM ( Advisory[AUM] ) )
)
RETURN
CALCULATE ( SUM ( Advisory[AUM] ), 'Table'[YearMonthOrder] = _last_month )
)
You can do the same for Total NET XP, only the SUM expression will change.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
123 | |
85 | |
85 | |
70 | |
51 |
User | Count |
---|---|
205 | |
153 | |
97 | |
79 | |
69 |