Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a set of top-level metric that counts the number of units wholesaled or final delivered in a given month -
=num(count ({$<[wholesale_month]*=[i_month],[wholesale_year]*=[i_year]>} unit),'#,##0')
=num(count({$<[fd_month] *=[i_month],[fd_year] *=[i_year]>}[unit]),'#,##0')
I govern the selection of year and month using list boxes tied to i_year and i_month as shown in the image.
This works.
However, if only the year is selected and nothing in month, the metrics show 0. How do I extend the metric expressions so that I get a yearly value if the year is selected and a monthly value if both year and month are selected?
Hi @akhwaja1 , you can create a variable like this :
vi_month = max(i_month)
then use it in your expression :
=num(count ({$<[wholesale_month]*=[$(vi_month)],[wholesale_year]*=[i_year]>} unit),'#,##0')
so if there is no selection over month, or of the user select two o more values over month its going to take the max month