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!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello
I have a report with the measure:
Solved! Go to Solution.
I would suggest to
1 - create a calculated column in the Calendar table
2 - use this DAX template code for the measure
If you want to see details, file is here for your convenience
https://drive.google.com/drive/folders/1syEbfXegdWm_ZT7kW4SsMXFvWjgLj0gz?usp=drive_link
If this helped, please consider giving kudos and mark as a solution
@mein replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
Hi,
Please try something like below whether it works.
And, for your reference, please check the attached pbix file.
Last Year expected result: =
VAR _maxdate = MAX(SalesTransactionDetails[CreateDate])
VAR _untilmaxdate = ADDCOLUMNS(
FILTER(
'Date Table',
'Date Table'[Date] <= _maxdate
),
"@lastyearsales", CALCULATE(
[Vendas],
SAMEPERIODLASTYEAR('Date Table'[Date])
)
)
RETURN
SUMX(
_untilmaxdate,
[@lastyearsales]
)
Hi @Jmrc16 ,
Thank you @Jihwan_Kim and @FBergamaschi for the response provided!
Has your issue been resolved? If the response provided by the community member addressed your query, could you please confirm? It helps us ensure that the solutions provided are effective and beneficial for everyone.
Thank you for your understanding!
Hi,
Please try something like below whether it works.
And, for your reference, please check the attached pbix file.
Last Year expected result: =
VAR _maxdate = MAX(SalesTransactionDetails[CreateDate])
VAR _untilmaxdate = ADDCOLUMNS(
FILTER(
'Date Table',
'Date Table'[Date] <= _maxdate
),
"@lastyearsales", CALCULATE(
[Vendas],
SAMEPERIODLASTYEAR('Date Table'[Date])
)
)
RETURN
SUMX(
_untilmaxdate,
[@lastyearsales]
)
I would suggest to
1 - create a calculated column in the Calendar table
2 - use this DAX template code for the measure
If you want to see details, file is here for your convenience
https://drive.google.com/drive/folders/1syEbfXegdWm_ZT7kW4SsMXFvWjgLj0gz?usp=drive_link
If this helped, please consider giving kudos and mark as a solution
@mein replies or I'll lose your thread
Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page
Consider voting this Power BI idea
Francesco Bergamaschi
MBA, M.Eng, M.Econ, Professor of BI
You could use
Sales LY =
VAR MaxDate =
CALCULATE (
MAX ( SaleTransactionDetails[CreateDate] ),
REMOVEFILTERS ( 'Date Table' )
)
VAR DatesThisYear =
DATESBETWEEN ( 'Date Table'[Date], DATE ( YEAR ( MaxDate ), 1, 1 ), MaxDate )
VAR Result =
CALCULATE ( [Vendas], SAMEPERIODLASTYEAR ( DatesThisYear ) )
RETURN
Result
I tried this solution, but when I put the measure in a matrix and put month in the lines, value doesn´t filter, it only shows the same value for al months. I think it's the "removefiltrs" impact
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 14 | |
| 7 | |
| 4 | |
| 4 | |
| 3 |
| User | Count |
|---|---|
| 23 | |
| 10 | |
| 10 | |
| 6 | |
| 5 |