Dimension using GROUP BY from View

gan1
New Member

Hi all, I have a

view: my_app {

dimension: time { #… }
dimension: device_id { #… }
dimension: todo {
# SELECT sum(time) FROM my_app GROUP BY device_id
}
}

I would like to ask how I can format the SELECT statement above using LookML.

Thank you for your help!

0 3 5,344
3 REPLIES 3

You don’t really have to format it at all. If you create a measure of type sum then when you select device_id in your Look/Explore, the measure will be aggregated to the appropriate level. The timension time has to be a number of course for this to work.

measure: todo {
    type: sum
    sql: ${time} ;;
    value_format: 
}

I added value_format in case you want to format the measure in specific way.

gan1
New Member

Thank you very much Dawid for your answer.

I was so caught up with figuring out grouping device_id in LookML that I forgot it could be selected in the Explore page.

You have helped me solved this, thank you very much once again!

gan1
New Member

Solved, thank you.

Top Labels in this Space
Top Solution Authors