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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.