Dashboard Mode - VALUES and DISTINCT
Business Question
Which unique product categories and their sales amounts are in our sales data? We want to see distinct categories and total sales per category.
Which unique product categories and their sales amounts are in our sales data? We want to see distinct categories and total sales per category.
| OrderID | ProductCategory | SalesAmount |
|---|---|---|
| 1001 | Electronics | 200 |
| 1002 | Furniture | 450 |
| 1003 | Electronics | 300 |
| 1004 | Clothing | 150 |
| 1005 | Furniture | 200 |
| 1006 | Clothing | 100 |
Total Sales = SUM(Sales[SalesAmount])Distinct Categories = DISTINCT(Sales[ProductCategory])Total Sales by Category = SUM(Sales[SalesAmount]) grouped by ProductCategoryVALUES(Sales[ProductCategory])+----------------------+---------------------------+ | Total Sales | Distinct Categories | | (KPI Card) | (Table Visual 1) | +----------------------+---------------------------+ | Sales by Category Table (Table Visual 2) | +-----------------------------------------------------+ | VALUES Output Table (Table Visual 3) | +-----------------------------------------------------+
Applying a slicer filter on ProductCategory updates all tables and the KPI card to show data only for the selected categories. For example, selecting 'Electronics' filters the sales and recalculates totals accordingly.
If you add a filter to show only Furniture category, which components update and what results do they show?
VALUES and DISTINCT?VALUES behaviorVALUES returns unique values from a column and includes blank values if they exist.DISTINCT behaviorDISTINCT returns unique values but excludes blank values from the result.VALUES includes blanks, DISTINCT excludes blanks -> Option AProduct[Category] using DISTINCT?Product[Category].VALUES and DISTINCT take a column reference in parentheses. The correct syntax is DISTINCT(Product[Category]).Sales with a column CustomerID containing values [1, 2, 2, 3, BLANK, 3], what will be the result of COUNTROWS(VALUES(Sales[CustomerID]))?CustomerID are 1, 2, 3, and BLANK. That is 4 unique values.COUNTROWS on VALUESVALUES returns unique values including blanks, so COUNTROWS counts 4 rows.UniqueProducts = DISTINCT(Product[ProductName]). When you use it in a card visual, it shows an error. What is the problem?DISTINCT returns a table of unique values, not a single number or scalar value.Customers[Name] column. Which DAX expression should you use to create a calculated table for this slicer?VALUES and DISTINCT return unique values, but VALUES includes blanks while DISTINCT excludes them.DISTINCT returns unique values excluding blanks, which is perfect for a slicer.CustomerNames = DISTINCT(Customers[Name]) directly provides unique non-blank names without needing extra filtering.Pass the test and this pattern moves unknown