Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Dimension in Expression

Hi,

I have a simple bar graph illustrating the following formula:

=(only({<Companyname,Year={$(vYEAR3)}>}[Data])

-only({<Companyname,Year={$(=(vYEAR3)-1)}>}[Data]))

/(only({<Companyname,Year={$(vYEAR3)}>}[Data]))

I am using a fader for the variable.

However, I do have other bar graphs showing data for the dimension year.

How can I use such a dimension in the metioned formula to get graphical results for all available years?

Data looks like the following:

CompanynameYearData
aaa2014325
aaa2013321
aaa2012231
bbb2014111
bbb2013222
bbb2012333

Cheers!

1 Solution

Accepted Solutions
sunny_talwar

Try this:

(Only({<Companyname>} Data) - Above(Only({<Companyname>} Data)))/Only({<Companyname>} Data)

or

(Only({<Companyname>} Data) - Below(Only({<Companyname>} Data)))/Only({<Companyname>} Data)

You might have to play around with the sorting, but I think one of these should work

View solution in original post

9 Replies
Digvijay_Singh

Didn't understand the requirement, Can you elaborate your dimension, measure and share the output image you need to create.

It seems you want to modify the given expression in some way but not sure what exactly you need.

sunny_talwar

What is your dimension here? or are you doing this in a text box object?

Not applicable
Author

That is what I´ve got and happy with:

Unbenannt.PNG

with bars beeing =only({$<Companyname=xxx>}[data])

with line beeing =avg([data])

In chart properties I have added "year" under dimensions.

I just dont know the general expression to get a value like this for bar 2014:

=(only({<Companyname,Year={2014}>}[Data])

-only({<Companyname,Year={2013}>}[Data]))

/(only({<Companyname,Year={2014)}>}[Data]))

Tried "Max(Year)", but didn´t work...

sunny_talwar

Try this:

(Only({<Companyname>} Data) - Above(Only({<Companyname>} Data)))/Only({<Companyname>} Data)

or

(Only({<Companyname>} Data) - Below(Only({<Companyname>} Data)))/Only({<Companyname>} Data)

You might have to play around with the sorting, but I think one of these should work

Not applicable
Author

Good work, thanks!

Anyway, one visual problem left.

Referring to the above chart, when I am clicking on one bar that year will show up, clicking on it again I see the whole chart again.

That doesn´t work when using your expressions. It says no data available.

sunny_talwar

May be try this:

(Only({<Companyname>} Data) -

If(Only({<Companyname>} Data)  > 0, Above(Only({<Companyname, Year>} Data)))

)/Only({<Companyname>} Data)

Not applicable
Author

(Only({<Companyname>} Data) -

Above(Only({<Companyname, Year>} Data))

)/Only({<Companyname>} Data)


That worked out, thanks!

Not applicable
Author

Well, is that not working for different data?

Like:

(Only({<Companyname>} DataX) -

Above(Only({<Companyname, Year>} DataY))

)/Only({<Companyname>} DataZ)

sunny_talwar

Difficult to say what might be the reason. May be there are more than one values and you need to use Sum instead of Only?

=(Sum({<Companyname>} DataX) - Above(Sum({<Companyname, Year>} DataY))/Sum({<Companyname>} DataZ)