Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

how to I make a date by December?

Hi, all

 

I am wondering how should I create the measure.

Data is available from March.
I wish I could see the full year of the date.
I want it to be displayed as 0 in January and February there is no data, and to be blank on other days(May to Dec).

 

I have calender table like below.

multt0_1-1649212254970.png

 

And I made measure like
IF(COUNTROWS('Table')=BLANK(),0,COUNTROWS('Table'))

 

multt0_0-1649211704951.png

 

I need a DAX solution, Thanks!

1 ACCEPTED SOLUTION
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

Maybe you can try this expressoin.

Measure = 
var _c = COUNTROWS(FILTER('Fact table',[Date].[MonthNo]=SELECTEDVALUE('Calendar'[Date].[MonthNo])))
return
IF(_c=BLANK()&& SELECTEDVALUE('Calendar'[Date].[MonthNo])<month(TODAY()),0,_c)

Don't forget to adjust the type of the x-axis to continuous. And customize the end of the x-axis to be the maximum date of the calendar table. Use fx icon for this.

vchenwuzmsft_0-1649412639299.png

result:

vchenwuzmsft_1-1649412714320.png

 

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-chenwuz-msft
Community Support
Community Support

Hi @Anonymous,

 

Maybe you can try this expressoin.

Measure = 
var _c = COUNTROWS(FILTER('Fact table',[Date].[MonthNo]=SELECTEDVALUE('Calendar'[Date].[MonthNo])))
return
IF(_c=BLANK()&& SELECTEDVALUE('Calendar'[Date].[MonthNo])<month(TODAY()),0,_c)

Don't forget to adjust the type of the x-axis to continuous. And customize the end of the x-axis to be the maximum date of the calendar table. Use fx icon for this.

vchenwuzmsft_0-1649412639299.png

result:

vchenwuzmsft_1-1649412714320.png

 

 

Pbix in the end you can refer.

Best Regards

Community Support Team _ chenwu zhu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , using a date table ,

 

example

Measure =

var _lastmonth = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD(dateadd('Date'[Date],12- month(Today()),MONTH)))

 

return 

if(isblank(_lastMonth), 0, SUM(Sales[Sales Amount]) )

 


To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5bd4

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.