The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
Hello everyone,
How can i create a measure to show current month and previous month sale from Northwind Traders dataset
Link download dataset: https://maven-datasets.s3.amazonaws.com/Northwind+Traders/Northwind+Traders.zip
Solved! Go to Solution.
Hi @NQT1711
Please try the following Dax:
Current Month Sales =
CALCULATE (
SUM ( 'Northwind Traders'[Total_sale] ),
FILTER (
ALL ( 'Northwind Traders' ),
MONTH ( 'Northwind Traders'[Date] )
= MONTH ( SELECTEDVALUE ( 'Northwind Traders'[Date] ) )
)
)
Last Month Sales =
VAR current_month =
MONTH ( SELECTEDVALUE ( 'Northwind Traders'[Date] ) )
RETURN
CALCULATE (
SUM ( 'Northwind Traders'[Total_sale] ),
FILTER (
ALL ( 'Northwind Traders' ),
MONTH ( 'Northwind Traders'[Date] ) = current_month - 1
)
)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @NQT1711
Please try the following Dax:
Current Month Sales =
CALCULATE (
SUM ( 'Northwind Traders'[Total_sale] ),
FILTER (
ALL ( 'Northwind Traders' ),
MONTH ( 'Northwind Traders'[Date] )
= MONTH ( SELECTEDVALUE ( 'Northwind Traders'[Date] ) )
)
)
Last Month Sales =
VAR current_month =
MONTH ( SELECTEDVALUE ( 'Northwind Traders'[Date] ) )
RETURN
CALCULATE (
SUM ( 'Northwind Traders'[Total_sale] ),
FILTER (
ALL ( 'Northwind Traders' ),
MONTH ( 'Northwind Traders'[Date] ) = current_month - 1
)
)
Result:
Best Regards,
Jayleny
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.