Forum Discussion

akhaliq7's avatar
akhaliq7
Post Prodigy
2 years ago
Solved

Help with Matrix

I would like my matrix to look like the below in Power BI:

 

 

Below is my current DAX code:

Admin = 
VAR StartDate = 
CALCULATE(
	STARTOFYEAR('DimDate'[Date]),
	DimDate[Date] = EDATE(TODAY(),-1)
)
VAR EndDate =
CALCULATE(
	ENDOFMONTH(DimDate[Date]),
	DimDate[Date] = EDATE(TODAY(),-1)
)
RETURN
CALCULATE(
    COUNT('Training'[#]),
    'Training'[Department] = "Admin",
	KEEPFILTERS(DimDate[Date] >= StartDate),
	KEEPFILTERS(DimDate[Date] <= EndDate)
)

 

The problem with above is zeros do not show in the date range specified, also when I  add coalesce(query,0) then zeros are added to every month row, I would only like months jan, feb to show as the current month checks are incomplete, don't want future months to show either, and my date table is from januaury to December 2024.

2 Replies