question regarding 'virtual' (calculated) dimensions

18 views
Skip to first unread message

Кирилл Марчук

unread,
Jun 22, 2018, 4:13:40 PM6/22/18
to Cubes
Hi all

With Cubes 1.1: say, I have a cube, dedicated to family spending budget, and an attribute 'subject' (who has spent), with values like 'Mother', 'Father', 'Son', 'Daughter'

What if I want to a virtual attribute with values like 'Parents' and 'Kids', so that 'parents' will sum up the mother's and father's spendings, and 'kids' those of 'son' and 'daughter'

I know I could do it easily with extra database column, but it there's a way to achieve this with model.json?

Thanks!

Kirill

José Juan Montes

unread,
Jun 28, 2018, 5:20:17 PM6/28/18
to cubes-...@googlegroups.com
Not with model JSON, with Cubes you'll need that extra column, but it could be a calculated column in your database system, using a view.

Since there is a 1-N relationship, you can also model that as a Dimension Hierarchy in Cubes, with two levels: the first being the "group" (parents / kids), and the second being the "individual" (mother / father / son / daughter).

Jose Juan Montes

--
You received this message because you are subscribed to the Google Groups "Cubes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cubes-discuss+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

José Juan Montes

unread,
Jun 28, 2018, 5:22:32 PM6/28/18
to cubes-...@googlegroups.com
I was incorrect. With Cubes 1.1, you have the "expression" attribute for attributes. Check https://cubes.readthedocs.io/en/latest/releases/1.1.html#expressions . I don't know if you can use logic or ternary operators in there, though.

Jose Juan Montes

Кирилл Марчук

unread,
Jul 9, 2018, 9:50:29 AM7/9/18
to Cubes
Thanks! I will check!

I've seen also a "formula" argument in attribute constructor, but I have not found any actual usage for that value in the code :(

What I've also tried to do is to turn negative values from the database into positive ones (the spendings are negative in the database, but that does not look great on charts). So far I could not do this..

Kirill

пятница, 29 июня 2018 г., 0:22:32 UTC+3 пользователь José Juan Montes написал:

Jose Juan Montes


Jose Juan Montes

To unsubscribe from this group and stop receiving emails from it, send an email to cubes-discus...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages