Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Help Writing Dax Measure for Sales

I have three tables that I am currently working with.

1 - tblSales - 

StateDate Sales
Washington14/01/2023 1
Washington28/01/2023 1
California13/02/2023 1
Washington01/03/2023 1
Washington02/03/2023 2
Washington03/03/2023 2
California03/03/2023 2
California04/03/2023 1
Florida15/03/2023 1

 

2- LaunchDate

StateSalesStartedDate
Washington14/01/2023
California13/02/2023
Florida15/02/2023

 

3- DataCalendar
List of all the dates between the minimun date in the tblSales[Date] up until TODAY().
In this table, I have a column called 'MonthnYear' that retrieves data in the following format the YYYYMM 

I would like to write a DaxMeasure that calculate 'Sales + 0' starting from the launchdate onwwards.

When I calculate SUM(tblSales[Sales]) I get the following result for the matrix:


I would like to get the following result

I want sales to show as 0 if there were none for the monthnyear being analysed.
However, if the MonthnYear is before the LaunchDate[SalesStartedDate], sales should show as blank.

Thanks in advance

11 Replies