Forum Discussion
Showing blank row and sum on Matrix when using Calculate Measure
Hello Power BI Community
I have a dataset which contains date and daily sales revenue for 2 years.
I want to show the total sales volume aggreagated by each month only for fiscal year using matrix.
Here is the Dax I wrote.
1 Reply
- amitchandak
Super User
PeraZo , if there null/blank dates in join they will come even if the filter is removing other non blank values.
In such measure, we add condition
CALCULATE (
SUM('SalesData'[sales]),
VAR FirstFiscalMonth = 3 -- Set the first month of the fiscal year
VAR LastDay =
MAX ( 'Calendar'[Date] )
VAR LastMonth =
MONTH ( LastDay )
VAR LastYear =
YEAR ( LastDay )
- IF ( LastMonth < FirstFiscalMonth, 1 )
VAR FilterYtd =
DATESBETWEEN (
'Calendar'[Date],
DATE ( LastYear, FirstFiscalMonth, 1 ),
LastDay
)
RETURN
FilterYtd
, not(isblank('SalesData'[sales date]))
)