Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Use of Only() Function

hi , i need help with the following dataset

                 YearMonthly Expense           Expense
2015Car Fuel5000
2015Electricity bill4500
2015A Expense7000
2015Other Expenditure4000
2015Sudden Expenditure3000
2015Bike Oil Treatment600
2015Cig Expense500
2015Clothing Expense3000
2015Car Maintainance4000
2015Outting Expense3000

in Chart Properties i only want to put add calculated dimension in =only({1}{<[Monthly Expense]={'Car Fuel'}>}[Monthly Expense])

and in expression =sum(Expense)

attached is the screenshot with an error.

looking forward to hear from you soon.

1 Solution

Accepted Solutions
Gysbert_Wassenaar

Fine, add an aggr around your calculated dimension expression:

=aggr(only({1}{<[Monthly Expense]={'Car Fuel'}>}[Monthly Expense]),[Monthly Expense])


And don't use calculated dimensions unless you must. Creating a new field in the script is a far better solution, if possible. Using set analysis expressions is generally also a better solution, if possible.


talk is cheap, supply exceeds demand

View solution in original post

5 Replies
Gysbert_Wassenaar

Don't use a calculated dimension. Use Monthly Expense as dimension and sum({<[Monthly Expense]={'Car Fuel'}>}Expense) as expression.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Basically Gysbert I am new to Qlikview for learning point of view i want to explore when shall we can use calculated dimension thats why i use it there.

Gysbert_Wassenaar

Fine, add an aggr around your calculated dimension expression:

=aggr(only({1}{<[Monthly Expense]={'Car Fuel'}>}[Monthly Expense]),[Monthly Expense])


And don't use calculated dimensions unless you must. Creating a new field in the script is a far better solution, if possible. Using set analysis expressions is generally also a better solution, if possible.


talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

Thanks alot Gysbert (y)

Anonymous
Not applicable
Author

It works , thanks. and thanks for prompt replies. I m very pleased.