Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi!
I have a simple measure but i can't get why it doesnt work.
For example i have table:
Year | LSV |
2018 | 1235 |
2019 | 5432 |
2020 | 7653 |
So i need to show value by the previous year in a row. I made the following measure:
Is there ant chance to get it works?
Solved! Go to Solution.
Hi @sugloevg
Measure has no real sense with just a [Year] in filter sentence
try
PREVLSV =
var _curYear = MAX('Table'[Year])
RETURN
CALCULATE(SUM('Table'[LSV]), FILTER(ALL('Table'), 'Table'[Year] = _curYear -1))
Try this @sugloevg
Prior Year =
VAR PriorYear = MAX('Table'[Year]) - 1
VAR Result =
SUMX(
FILTER(
ALL('Table'),
'Table'[Year] = PriorYear
),
'Table'[LSV]
)
RETURN
Result
Gets the current year, and then subtracts 1. Then, the SUMX() only works on the previous year's data from the table provided by FILTER().
Try this @sugloevg
Prior Year =
VAR PriorYear = MAX('Table'[Year]) - 1
VAR Result =
SUMX(
FILTER(
ALL('Table'),
'Table'[Year] = PriorYear
),
'Table'[LSV]
)
RETURN
Result
Gets the current year, and then subtracts 1. Then, the SUMX() only works on the previous year's data from the table provided by FILTER().
Thank you a lot, guys!
Try this @sugloevg
Prior Year =
VAR PriorYear = MAX('Table'[Year]) - 1
VAR Result =
SUMX(
FILTER(
ALL('Table'),
'Table'[Year] = PriorYear
),
'Table'[LSV]
)
RETURN
Result
It gets the current year, then subtracts 1. Then the SUMX() only operates on prior year data from the table provided by FILTER().
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingTry this DAX measure
PREVLSV =
VAR _Year =
SELECTEDVALUE ( 'Table'[Year] )
RETURN
CALCULATE (
SUM ( 'Table'[LSV] ),
FILTER ( ALL ( 'Table'[Year] ), 'Table'[Year] = _Year - 1 )
)
Did I answer your question? Mark my post as a solution!
Appreciate with a kudos 🙂
Hi @az38
I have used your formula but what if I want to get the month breakdown? It's showing the total sum but I know it's because of the Calculate Sum but don't know How to get month breakdown
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
97 | |
79 | |
66 | |
62 |
User | Count |
---|---|
145 | |
113 | |
105 | |
85 | |
65 |