0% found this document useful (0 votes)
5 views

DAX Functions

Uploaded by

Divya Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

DAX Functions

Uploaded by

Divya Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

DAX functions used in the project

sales = 'coffee_shop coffee_shop_sales'[transaction_qty] * 'coffee_shop


coffee_shop_sales'[unit_price]

Total Sales = SUM('coffee_shop coffee_shop_sales'[sales])

Total Quantities Sold = SUM('coffee_shop


coffee_shop_sales'[transaction_qty])

Total Orders = COUNT('coffee_shop coffee_shop_sales'[transaction_id])

Foot Note = "Hover on the visual to see details"

Hour = HOUR('coffee_shop coffee_shop_sales'[transaction_time])

Monthly Average Sales =

AVERAGEX(

VALUES('coffee_shop coffee_shop_sales'[transaction_date]),

'coffee_shop coffee_shop_sales'[Total Sales]

Current Month Orders = CALCULATE(

COUNT('coffee_shop coffee_shop_sales'[transaction_id]),

ALL('Date Table'[Month])

Current Month Quantity Sold = CALCULATE(

SUM('coffee_shop coffee_shop_sales'[transaction_qty]),
ALL('Date Table'[Month])

Current Month Sales = CALCULATE(

SUM('coffee_shop coffee_shop_sales'[sales]),

ALL('Date Table'[Month])

Previous Month Orders =

CALCULATE(

COUNT('coffee_shop coffee_shop_sales'[transaction_id]),

DATEADD('Date Table'[Date], -1, MONTH)

Previous Month Quantity Sold =

CALCULATE(

SUM('coffee_shop coffee_shop_sales'[transaction_qty]),

DATEADD('Date Table'[Date], -1, MONTH)

Previous Month Sales =

CALCULATE(

SUM('coffee_shop coffee_shop_sales'[sales]),

DATEADD('Date Table'[Date], -1, MONTH)

Category Sales MOM Comparison =

VAR Difference = [Current Month Sales] - [Previous Month Sales]

VAR PercentChange = DIVIDE(Difference, [Previous Month Sales], 0)


VAR Arrow = IF(Difference >= 0, "🔺", "🔻")

VAR FormattedDifference = FORMAT(ROUND(Difference/1000, 1),


"+#,##0.0k;-#,##0.0k")

VAR FormattedPercentChange = FORMAT(PercentChange, "+0.0%;-0.0%")

RETURN

IF(

ISBLANK([Previous Month Sales]),

"-- | --",

Arrow & FormattedPercentChange

Orders MOM Comparison =

VAR Difference = [Current Month Orders] - [Previous Month Orders]

VAR PercentChange = DIVIDE(Difference, [Previous Month Orders], 0)

VAR Arrow = IF(Difference >= 0, "🔺", "🔻")

VAR FormattedDifference = FORMAT(ROUND(Difference/1000, 1),


"+#,##0.0k;-#,##0.0k")

VAR FormattedPercentChange = FORMAT(PercentChange, "+0.0%;-0.0%")

RETURN

IF(

ISBLANK([Previous Month Orders]),

"-- | --",

Arrow & FormattedPercentChange & " | " & FormattedDifference & "
vs LM"

Quantity Sold MOM Comparison =

VAR Difference = [Current Month Quantity Sold] - [Previous Month


Quantity Sold]

VAR PercentChange = DIVIDE(Difference, [Previous Month Quantity Sold],


0)
VAR Arrow = IF(Difference >= 0, "🔺", "🔻")

VAR FormattedDifference = FORMAT(ROUND(Difference/1000, 1),


"+#,##0.0k;-#,##0.0k")

VAR FormattedPercentChange = FORMAT(PercentChange, "+0.0%;-0.0%")

RETURN

IF(

ISBLANK([Previous Month Quantity Sold]),

"-- | --",

Arrow & FormattedPercentChange & " | " & FormattedDifference & "
vs LM"

Sales MOM Comparison =

VAR Difference = [Current Month Sales] - [Previous Month Sales]

VAR PercentChange = DIVIDE(Difference, [Previous Month Sales], 0)

VAR Arrow = IF(Difference >= 0, "🔺", "🔻")

VAR FormattedDifference = FORMAT(ROUND(Difference/1000, 1),


"+#,##0.0k;-#,##0.0k")

VAR FormattedPercentChange = FORMAT(PercentChange, "+0.0%;-0.0%")

RETURN

IF(

ISBLANK([Previous Month Sales]),

"-- | --",

Arrow & FormattedPercentChange & " | " & FormattedDifference & "
vs LM"

Label for Category Placeholder = SELECTEDVALUE('coffee_shop


coffee_shop_sales'[product_category]) & " | " & FORMAT(ROUND([Total
Sales] / 1000, 1), "0.#") & "k" & " |" & [Category Sales MOM Comparison]
Label for Location Placeholder = SELECTEDVALUE('coffee_shop
coffee_shop_sales'[store_location]) & " | " & 'coffee_shop
coffee_shop_sales'[Sales MOM Comparison]

Label for Product Type Placeholder = SELECTEDVALUE('coffee_shop


coffee_shop_sales'[product_type]) & " | " & FORMAT(ROUND([Total Sales] /
1000, 1), "0.#") & "k" & " |" & [Category Sales MOM Comparison]

Placeholder = 0

You might also like