Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
I have a quite interesting request.
I have a table like this one:
| Type | Year | Price | Value1 | Value2 | Value3 |
| Home | 2021 | 9 | 2 | 3 | 4 |
| Home | 2022 | 27 | 5 | 6 | 7 |
| Home | 2023 | 42 | 4 | 5 | 6 |
| Terrain | 2021 | 7 | 2 | 4 | 1 |
| Terrain | 2022 | 11 | 1 | 1 | 2 |
My Price Column is calculated and gets it's value based on columns Value1, Value2 and Value3. But I need to also add the value of itself based on the previous year.
Could anyone share with me how to find this solution?
I thought of using something like this as the calculation of Price:
@Depso dos this work?
MEASURE =
VAR base =
FILTER ( ALL ( tbl ), tbl[Year] <= MAX ( tbl[Year] ) )
VAR grp =
VALUES ( tbl[Type] )
RETURN
CALCULATE ( SUM ( tbl[Value1] ), base, grp )
+ CALCULATE ( SUM ( tbl[Value2] ), base, grp )
+ CALCULATE ( SUM ( tbl[Value3] ), base, grp )
Unfortunatelly, no.
I need it to reference automatically the previous item in the same column like in the screenshot example below:
It should be based on the year.
@Depso Maybe:
var calculatedYear = 'Table'[Year]
var previousYear = calculatedYear - 1
var TypeVal = [Type]
var Value1get= MAXX( FILTER( 'Table','Table'[Year] = calculatedYear && 'Table'[Type]=TypeVal) , [Value1])
var Value2get= MAXX( FILTER( 'Table','Table'[Year] = calculatedYear && 'Table'[Type]=TypeVal) , [Value2])
var Value3get= MAXX( FILTER( 'Table','Table'[Year] = calculatedYear && 'Table'[Type]=TypeVal) , [Value3])
var {YUValue1get= MAXX( FILTER( 'Table','Table'[Year] = previousYear && 'Table'[Type]=TypeVal) , [Value1])
var PYValue2get= MAXX( FILTER( 'Table','Table'[Year] = previousYear && 'Table'[Type]=TypeVal) , [Value2])
var PYValue3get= MAXX( FILTER( 'Table','Table'[Year] = previousYear && 'Table'[Type]=TypeVal) , [Value3])
var Result = Value1get + Value2get + Value3get + PYValue1get + PYValue2get + PYValue3get
Return
Result
This does not work because it only takes into account the previous value and I need it to keep adding up to the original value each time
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 46 | |
| 43 | |
| 39 | |
| 19 | |
| 15 |
| User | Count |
|---|---|
| 68 | |
| 67 | |
| 31 | |
| 27 | |
| 24 |