Forum Discussion
NipponSahore
Resolver II
10 years agoDrill by decade
Hi Guys, I'm quite new to PowerBI and i was wondering if there is any way to Drilldown an Year value by decade. I have a sample dataset of IMDB top 250 movies and want to drill down by decade, b...
Chiranjit
8 years agoFrequent Visitor
To get a decade bucket first extract a Year column from date column. Change the data type of the Year column from date to text.
Then create this custom column.
Decade bucket =
var yearlastdigit = RIGHT ( Decade[Year], 1 )
return
IF (
yearlastdigit = "0",
IF (
YEAR ( Decade[Date] ) < 2000,
"19"
& INT (
( YEAR ( Decade[Date] ) - 1900 )
/ 10
)
& "0"
& " - "
& (
CEILING ( YEAR ( Decade[Date] ) / 10, 1 )
* 10
+ 10
)
- 1,
"20"
& INT (
( YEAR ( Decade[Date] ) - 2000 )
/ 10
)
& "0"
& " - "
& (
CEILING ( YEAR ( Decade[Date] ) / 10, 1 )
* 10
+ 10
)
- 1
),
IF (
YEAR ( Decade[Date] ) < 2000,
"19"
& INT (
( YEAR ( Decade[Date] ) - 1900 )
/ 10
)
& "0"
& " - "
& (
CEILING ( YEAR ( Decade[Date] ) / 10, 1 )
* 10
)
- 1,
"20"
& INT (
( YEAR ( Decade[Date] ) - 2000 )
/ 10
)
& "0"
& " - "
& (
CEILING ( YEAR ( Decade[Date] ) / 10, 1 )
* 10
)
- 1
)
)
You will get the output like this.
Now you can drill down from Decade bucket to year value.