Forum Discussion
Calendar, multiple dates but dates depend on each other
- Anonymous3 years ago
Hi BartDekeyser ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Year by year% = VAR _selcat = SELECTEDVALUE ( 'Table'[Category] ) VAR _selyear = SELECTEDVALUE ( 'Table'[Year] ) VAR _selpubyear = SELECTEDVALUE ( 'Table'[PubYear] ) VAR _prepubyear = CALCULATE ( MAX ( 'Table'[PubYear] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Category] = _selcat && 'Table'[Year] = _selyear && 'Table'[PubYear] < _selpubyear ) ) VAR _prepyvalue = CALCULATE ( SUM ( 'Table'[Value] ), FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Category] = _selcat && 'Table'[Year] = _selyear && 'Table'[PubYear] = _prepubyear ) ) RETURN IF ( ISBLANK ( _prepyvalue ), BLANK (), DIVIDE ( SUM ( 'Table'[Value] ) - _prepyvalue, _prepyvalue ) )In addition, you can refer the following videos to get it.
Power BI Year-Over-Year Growth % Calculations [DAX] - YouTube
Power BI YEAR over YEAR (YoY) Change Calculations [DAX]
If the above one can't help you, could you please explain your expected result base on your shared sample data?Thank you.
Best Regards
Hi BartDekeyser ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Year by year% =
VAR _selcat =
SELECTEDVALUE ( 'Table'[Category] )
VAR _selyear =
SELECTEDVALUE ( 'Table'[Year] )
VAR _selpubyear =
SELECTEDVALUE ( 'Table'[PubYear] )
VAR _prepubyear =
CALCULATE (
MAX ( 'Table'[PubYear] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Category] = _selcat
&& 'Table'[Year] = _selyear
&& 'Table'[PubYear] < _selpubyear
)
)
VAR _prepyvalue =
CALCULATE (
SUM ( 'Table'[Value] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[Category] = _selcat
&& 'Table'[Year] = _selyear
&& 'Table'[PubYear] = _prepubyear
)
)
RETURN
IF (
ISBLANK ( _prepyvalue ),
BLANK (),
DIVIDE ( SUM ( 'Table'[Value] ) - _prepyvalue, _prepyvalue )
)
In addition, you can refer the following videos to get it.
Power BI Year-Over-Year Growth % Calculations [DAX] - YouTube
Power BI YEAR over YEAR (YoY) Change Calculations [DAX]
If the above one can't help you, could you please explain your expected result base on your shared sample data?Thank you.
Best Regards
- BartDekeyser3 years agoFrequent Visitor
i tried you solution, but it is not what i wanted. I want to see the evolution through the years using their maximum publication year per categorie. So
For X 2009's max pubyear = 2021 for Y 2009's max pubyear = 2019, for 2010 for x and y it is 2021.
And on another visual i would want to see the evolution of 2009 through different pubyears.
So for X on 2009 i want to see 2015 vs 2019 vs 2021