Forum Discussion

KH_Mike's avatar
KH_Mike
Helper III
5 years ago
Solved

Use Variable to select Column

Hi All,

 

Is it possible to use Variable to select sutiable column for calculation?

The scenarios is like below. I have two slice which contain [Fiscal Year] and [Year]. Right now my formula is like below

 

Last Year = 

Var LY = selectedvalue([Fiscal Year])-1

Return

Calculation(sum([Amount)],[Fiscal Year] = LY)

 

But this formula can only fulfill when user select [Fiscal Year]. I want to know if there is any formula can also work with [Year] by user selection. If user make the selection on [Fiscal Year], the the calculation will based on [Fiscal Year]. If user make the selection on [Year], the the calculation will based on [Year]. 

1 Reply