Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi all,
I'm trying to create a measure where I sum the total revenue field based on my Time Period filter (Month, Quarter, Year). For the year, I need my measure to say that if it's not the current year then return the amounts for December only. If it's the current year, then return last months amount (If it's August, show July). I have a Month Number & Current Year column that hopefully helps.
Solved! Go to Solution.
Hi @Anonymous ,
I have built a data sample from 2019/1/1 to 2021/12/31 (I think Month Number & Current Year may better split to Year and Month column)
And according to your description, you need to create a new table for slicer like this:
ForSlicer = DISTINCT( SELECTCOLUMNS('Table',"Year",[Year],"Month",[Month]))
Then create a measure and display it in Card visual:
Measure =
VAR _year =
SELECTEDVALUE ( ForSlicer[Year] )
VAR _month =
SELECTEDVALUE ( ForSlicer[Month] )
RETURN
IF (
_year <> YEAR ( TODAY () ),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Year] = _year && [Month] = 12 )
),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', [Year] = _year && 'Table'[Month] = _month - 1 )
)
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
I have built a data sample from 2019/1/1 to 2021/12/31 (I think Month Number & Current Year may better split to Year and Month column)
And according to your description, you need to create a new table for slicer like this:
ForSlicer = DISTINCT( SELECTCOLUMNS('Table',"Year",[Year],"Month",[Month]))
Then create a measure and display it in Card visual:
Measure =
VAR _year =
SELECTEDVALUE ( ForSlicer[Year] )
VAR _month =
SELECTEDVALUE ( ForSlicer[Month] )
RETURN
IF (
_year <> YEAR ( TODAY () ),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', 'Table'[Year] = _year && [Month] = 12 )
),
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER ( 'Table', [Year] = _year && 'Table'[Month] = _month - 1 )
)
)
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please provide sample data in usable format (not as a picture - maybe insert into a table?) and show the expected outcome.
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 104 | |
| 82 | |
| 71 | |
| 50 | |
| 46 |