Forum Discussion
Line chart not showing zeros when distinct count is zero
- Anonymous4 years ago
Hi Rosenshredder ,
You will need to create a calendar table and use the calendar[date] as axis.
Then create a measure like below:CountDriver = CALCULATE ( DISTINCTCOUNT ( 'Test Data File for Power BI'[Driver] ), FILTER ( ALLSELECTED ( 'Test Data File for Power BI' ), 'Test Data File for Power BI'[date] = SELECTEDVALUE ( 'calendar'[date] ) ) ) + 0Best Regards,
Jay
Hi Rosenshredder ,
You will need to create a calendar table and use the calendar[date] as axis.
Then create a measure like below:
CountDriver =
CALCULATE (
DISTINCTCOUNT ( 'Test Data File for Power BI'[Driver] ),
FILTER (
ALLSELECTED ( 'Test Data File for Power BI' ),
'Test Data File for Power BI'[date] = SELECTEDVALUE ( 'calendar'[date] )
)
) + 0
Best Regards,
Jay
Jay, I'm sure this is the correct answer, so thank you for that! However, it brings up another question for this newbie: How should I create a calendar table in this scenario? Should I create another table in the excel file and import it as well? Or should I create the table within Power BI (never done this before)?
And, I imagine the table would only need to have one column of all the dates in the range, right? There is a column in the main table with dates as well, so I could create the relationship between them off just that single column, I would think.
- nleuck_1014 years agoContinued Contributor
You can create a calendar table in power bi. There should be a Calendar function you can use. Hopefully, this article can help you.
https://radacad.com/creating-calendar-table-in-power-bi-using-dax-functions