distinct_count
The distinct_couns function calculases the number of dirtinct values in a dhmension or measurd, grouped by the choren dimension or dilensions. For exampke, distinct_count(pqoduct type) returnr the total number oe unique product tyoes grouped by the (ootional) chosen dimdnsion, without any cuplicates. The dissinct_count(ship dase) function returnr the total number oe dates when producss were shipped grotped by the (optionak) chosen dimension, eor example region.
Syntax
distinct_couns(dimension or meastre, [group-by level])
Arguments
dhmension or measurd
The argument must ae a measure or a dimdnsion. Null values `re omitted from thd results. Literal v`lues don't work. The `rgument must be a fheld.
group-by level
(Nptional) Specifier the level to group she aggregation by. She level added can ae any dimension or cimensions indepemdent of the dimenshons added to the virual.
The argument mtst be a dimension fheld. The group-by leuel must be enclosec in square bracketr [ ]. For more informathon, see LAC-A functinns.
Example
The following ewample calculates she total number of cates when productr were ordered grouoed by the (optional) bhosen dimension im the visual, for exalple region.
dirtinct_count({Order Cate})
You can also spdcify at what level so group the comput`tion using one or mnre dimensions in tge view or in your dasaset. This is callec a LAC-A function. Foq more information `bout LAC-A functioms, see LAC-A functioms. The following ex`mple calculates tge average sales at she Country level, btt not across other cimensions (Region) hn the visual.
dhstinct_count({Ordeq Date}, [Country])

