Forum Discussion
Calculating Retirement Date
- 9 years ago
Hi sokatenaj,
Add a column to your table with the following sintax:
Retirement Date = SWITCH ( TRUE (), YEAR ( People[Birth-Date] ) >= 1937 && YEAR ( People[Birth-Date] ) <= 1942, ( DATE ( ( YEAR ( [Birth-Date] ) + 65 ), MONTH ( People[Birth-Date] ), DAY ( People[Birth-Date] ) ) ), YEAR ( People[Birth-Date] ) >= 1942 && YEAR ( People[Birth-Date] ) <= 1959, ( DATE ( ( YEAR ( [Birth-Date] ) + 66 ), MONTH ( People[Birth-Date] ), DAY ( People[Birth-Date] ) ) ), ( DATE ( ( YEAR ( [Birth-Date] ) + 67 ), MONTH ( People[Birth-Date] ), DAY ( People[Birth-Date] ) ) ) )This will give the following result:
Regards,
MFelix
- 9 years ago
Hi sokatenaj,
Creae this measure:
Over_Under_ = VAR within_5 = CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 5 Years" ) VAR within_3 = CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 3 Years" ) RETURN IF ( VALUES ( People[OVer/Under] ) = "Within 5 years", within_5 + within_3, COUNT ( People[OVer/Under] ) )
Then add it to your graph, making this in this way you will be double counting the within 3 years and change the way you are calculating the 100% because instead of having 18 names you will get 21.
I have made this new formula that calculates the percentages acummulated but in this way your chart will be above 100%:
Over_Under_% = VAR within_5 = DIVIDE ( CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 5 Years" ), CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) ) ) VAR within_3 = DIVIDE ( CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 3 Years" ), CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) ) ) RETURN IF ( VALUES ( People[OVer/Under] ) = "Within 5 years", within_5 + within_3, DIVIDE ( CALCULATE ( COUNT ( People[OVer/Under] ) ), CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) ) ) )to me these to totals don't make sense to be presented in the same chart because as said before you will be double counting the within 3 years values.
Please tell me if I can help in anything else.
Regards,
MFelix
Hi MFelix,
That makes sense, but I want to have 4 categories on the X Axis of the 100% stacked bar which is Over retirement, within 3 years, within 5 years, and not eligible. The within 5 years needs to also have the within 3 years data rolled into it as a cumulative sum. That's where I'm stuck.
Hi sokatenaj,
Creae this measure:
Over_Under_ = VAR within_5 = CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 5 Years" ) VAR within_3 = CALCULATE ( COUNT ( People[OVer/Under] ), People[OVer/Under] = "Within 3 Years" ) RETURN IF ( VALUES ( People[OVer/Under] ) = "Within 5 years", within_5 + within_3, COUNT ( People[OVer/Under] ) )
Then add it to your graph, making this in this way you will be double counting the within 3 years and change the way you are calculating the 100% because instead of having 18 names you will get 21.
I have made this new formula that calculates the percentages acummulated but in this way your chart will be above 100%:
Over_Under_% =
VAR within_5 =
DIVIDE (
CALCULATE (
COUNT ( People[OVer/Under] ),
People[OVer/Under] = "Within 5 Years"
),
CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) )
)
VAR within_3 =
DIVIDE (
CALCULATE (
COUNT ( People[OVer/Under] ),
People[OVer/Under] = "Within 3 Years"
),
CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) )
)
RETURN
IF (
VALUES ( People[OVer/Under] ) = "Within 5 years",
within_5 + within_3,
DIVIDE (
CALCULATE ( COUNT ( People[OVer/Under] ) ),
CALCULATE ( COUNT ( People[OVer/Under] ), ALLSELECTED ( People[OVer/Under] ) )
)
)
to me these to totals don't make sense to be presented in the same chart because as said before you will be double counting the within 3 years values.
Please tell me if I can help in anything else.
Regards,
MFelix
- sokatenaj9 years agoAdvocate II
Good God that is complicated! I really appreciate it. Thank you so much!!!!!