You are on page 1of 6

### 1.

ordertype:

```DAX

ordertype = IF(Superstore[Quantity] > 10, "Bulk Order", "Normal Order")

```

- **Explanation:** This DAX expression creates a calculated column named "ordertype" in the
Superstore table. If the quantity of an order is greater than 10, it classifies the order as a "Bulk
Order"; otherwise, it classifies it as a "Normal Order".

### 2. profitratio:

```DAX

profitratio = Superstore[Profit] / Superstore[Sales]

```

- **Explanation:** This DAX expression calculates the profit ratio for each row in the Superstore
table by dividing the profit by the sales amount.

### 3. %age Sales:

```DAX

%age Sales = SUM(Superstore[Sales]) / [Overall Sales using Cal]

```

- **Explanation:** This DAX measure calculates the percentage of total sales for each row in the
Superstore table by dividing the sales amount by the overall sales amount calculated using another
measure named "Overall Sales using Cal".
### 4. %age sales from US:

```DAX

%age sales from US = [US Sales] / SUM(Superstore[Sales])

```

- **Explanation:** This DAX measure calculates the percentage of sales from the United States for
each row in the Superstore table by dividing the US sales amount by the total sales amount.

### 5. All Sales:

```DAX

All Sales = CALCULATE(SUM(Superstore[Sales]), ALL(Superstore))

```

- **Explanation:** This DAX measure calculates the total sales amount regardless of any filters
applied to the Superstore table. It removes any existing filters on the Superstore table using the ALL
function.

### 6. US Sales:

```DAX

US Sales = CALCULATE(SUM(Superstore[Sales]), Superstore[Country] = "United States")

```

- **Explanation:** This DAX measure calculates the total sales amount for the United States by
applying a filter to the Superstore table to include only rows where the country is "United States".

### 7. US avg Sales:

```DAX

US avg Sales = CALCULATE(AVERAGE(Superstore[Sales]), Superstore[Country] = "United States")

```
- **Explanation:** This DAX measure calculates the average sales amount for the United States by
applying a filter to the Superstore table to include only rows where the country is "United States".

### 8. Overall Sales using Cal:

```DAX

Overall Sales using Cal = CALCULATE(SUM(Superstore[Sales]), Superstore[Category] IN {"Furniture",


"Office Supplies", "Technology"})

```

- **Explanation:** This DAX measure calculates the overall sales amount for specific categories
(Furniture, Office Supplies, Technology) by applying a filter to the Superstore table.

### 9. Consumer Sales:

```DAX

Consumer Sales = CALCULATE(SUM(Superstore[Sales]), Superstore[Segment] = "Consumer")

```

- **Explanation:** This DAX measure calculates the total sales amount for the "Consumer" segment
by applying a filter to the Superstore table to include only rows where the segment is "Consumer".

MonthIncINSales = IF(ISBLANK([prevMonth]),"NA", (SUM(Superstore[Sales])/[prevMonth])-1)


prevMonth = CALCULATE(SUM(Superstore[Sales]),PREVIOUSMONTH(Superstore[start_of_month]))
### prevMonth:

```DAX

prevMonth = CALCULATE(SUM(Superstore[Sales]), PREVIOUSMONTH(Superstore[start_of_month]))

```

- **Explanation:**

- `PREVIOUSMONTH(Superstore[start_of_month])`: This function returns the table containing the


previous month's start dates. It uses the `[start_of_month]` column in the Superstore table, which is
assumed to contain the start dates of each month.

- `SUM(Superstore[Sales])`: This function calculates the sum of sales for the rows filtered by the
previous month's start dates. It sums up the sales amounts for the previous month.

- **Overall Explanation:**

- The `CALCULATE` function modifies the filter context by applying the filter from the
`PREVIOUSMONTH` function to the `Superstore[start_of_month]` column.

- This effectively calculates the total sales amount for the previous month based on the start dates
of each month.

```DAX

QTDSales = CALCULATE(SUM(Superstore[Sales]), DATESQTD(Superstore[start_of_month]))

```

- **Explanation:**

- `DATESQTD(Superstore[start_of_month])`: This function returns a table containing all dates from


the beginning of the current quarter up to the current date. It uses the `[start_of_month]` column in
the Superstore table, which is assumed to contain the start dates of each month.

- `SUM(Superstore[Sales])`: This function calculates the sum of sales for the rows filtered by the
dates within the current quarter-to-date period. It sums up the sales amounts for the current quarter
up to the current date.

- **Overall Explanation:**

- The `CALCULATE` function modifies the filter context by applying the filter from the `DATESQTD`
function to the `Superstore[start_of_month]` column.

- This effectively calculates the total sales amount for the current quarter-to-date based on the start
dates of each month.
### startmth:

```DAX

startmth = STARTOFMONTH(Superstore[Order Date])

```

- **Explanation:** This DAX expression calculates the start date of the month for each row in the
Superstore table based on the "Order Date" column. It returns the first day of the month for the
corresponding order date.

### eomonth:

```DAX

eomonth = EOMONTH(Superstore[Order Date], 0)

```

- **Explanation:** This DAX expression calculates the end date of the month for each row in the
Superstore table based on the "Order Date" column. It returns the last day of the month for the
corresponding order date. The second argument (0) specifies that the end of the current month
should be calculated.

### Currentdate:

```DAX

Currentdate = TODAY()

```

- **Explanation:** This DAX expression retrieves the current date at the time of evaluation. It returns
the current date as a static value.
### Day1:

```DAX

Day1 = DAY(Superstore[Order Date])

```

- **Explanation:** This DAX expression extracts the day component from the "Order Date" column
for each row in the Superstore table. It returns the day of the month for the corresponding order
date.

### monthname:

```DAX

monthname = Superstore[Order Date].[Month]

```

- **Explanation:** This DAX expression retrieves the month name from the "Order Date" column for
each row in the Superstore table. It returns the month name for the corresponding order date.

You might also like