Forum Discussion
Line chart show 0 for missing data and when slicer applied
- 5 years ago
Hi Binway ,
Please change the relationship between your date table and fact table to single direction
Then use the following measure:
New Amounts = VAR __min = CALCULATE ( MIN ( MonthlySales[month_starting]), ALLSELECTED(MonthlySales)) VAR __max = CALCULATE ( MAX ( MonthlySales[month_starting]), ALLSELECTED(MonthlySales)) VAR RESULT = IF(MAX(date_dim[first_day_of_month])>=DATE(YEAR(__min-10),MONTH(__min-10),1)&&MAX(date_dim[first_day_of_month])<=__max , SUM(MonthlySales[Sales])+0) return RESULTIf this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi Binway ,
Please try to use the following measure:
All Amounts =
VAR sales =
SUMMARIZE (
MonthlySales,
MonthlySales[Business],
date_dim[first_day_of_month],
"QTY", SUM ( MonthlySales[Sales] ) + 0
)
RETURN
SUMX ( sales, [QTY] )
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi Dedmon,
I was thinking a SUMX with a filter but the missing records are not appearing and the filtere does not work. I even tried ADDMISSINGITEM but can't seem to filter the dates before the Min and Max
EVALUATE
VAR __min = CALCULATE ( MIN ( MonthlySales[month_starting]), ALLSELECTED())
VAR __max = CALCULATE ( MAX ( MonthlySales[month_starting]), ALLSELECTED())
VAR sales =
SUMMARIZE (
MonthlySales,
MonthlySales[Business],
date_dim[first_day_of_month],
"QTY", SUM ( MonthlySales[Sales] ) + 0
)
RETURN
SUMX(FILTER(date_dim,
date_dim[first_day_of_month]>= __min
&&
date_dim[first_day_of_month]<= __max
),
sales,[QTY])
- v-deddai1-msft5 years ago
Community Support
Hi Binway ,
Please try to use the following measure:
measure = VAR __min = CALCULATE ( MIN ( MonthlySales[month_starting] ), ALLSELECTED () ) VAR __max = CALCULATE ( MAX ( MonthlySales[month_starting] ), ALLSELECTED () ) VAR sales = SUMMARIZE ( MonthlySales, MonthlySales[Business], date_dim[first_day_of_month], "QTY", SUM ( MonthlySales[Sales] ) + 0 ) RETURN SUMX ( FILTER ( sales, date_dim[first_day_of_month] >= __min && date_dim[first_day_of_month] <= __max ), [QTY] )If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
- Binway5 years ago
Helper II
Sorry Dedmon - same result where the +0 is just not working if you filter it. How would I create a "virtual table" with all the missing values, then filter that.
Thanks - appreciate the efforts.
- v-deddai1-msft5 years ago
Community Support