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
hari_bi
Helper I
Helper I

How to check the give date is end of month or not in DAX?

Hello All,

 

Please find the below table:-

Project new logic.PNG

If Actual is null and current month (Sep) not reached to End of Month i need to display the forecast value as project other wise i need to consider the Actual value as projection.

Here is my dax formaula:

 

Projection Test 1:=
VAR max_ship_date = MAX('Shipments'[TWE Shipment Received Reporting Period])
VAR LastDay = LASTDATE('Shipments'[TWE Shipment Received Reporting Period])
VAR Todays = TODAY()
VAR m_shipments = CALCULATE(SUM('Shipments'[Shipments]))  /*CALCULATE(SUM('Shipments'[Shipments]),FILTER('Date',Todays <> LastDay))*/
VAR m_forecast =   CALCULATE( SUM ('Shipments Forecast'[Forecast Volume]), FILTER('Date', 'Date'[Date] > max_ship_date))


RETURN   IF( m_shipments=BLANK() || Todays = LastDay ,m_forecast,m_shipments)

 

if actual is blank or null i am able to display the forecast value as projection but current month not reached yet to end now i need to display forecast value as project, here i am facing issue to get forecast data.

 

need help how to check the given date is not end of month and how to pick the forecast data and display as projection.

 

 

Thanks in Advance.

 

Regards,

Hari.

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

@hari_bi,

Based on your sample data, you can create the following columns in your table.

endofmonth = EOMONTH(Shipments[Date],0)
Project = IF(ISBLANK(Shipments[Actual])||Shipments[Date]<>Shipments[endofmonth],Shipments[Forecast],Shipments[Actual])

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
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-yuezhe-msft
Employee
Employee

@hari_bi,

Based on your sample data, you can create the following columns in your table.

endofmonth = EOMONTH(Shipments[Date],0)
Project = IF(ISBLANK(Shipments[Actual])||Shipments[Date]<>Shipments[endofmonth],Shipments[Forecast],Shipments[Actual])

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hari_bi
Helper I
Helper I

here i need to check 2 conditions if actuals are blank or actuals not reached to current month end i need to display the forecast values as Project other wise need to display actuals value as Project , like below :

 

IF( m_shipments=BLANK() || Todays = LastDay ,m_forecast,m_shipments)

 

presently sample data not available to share  sorry for the inconvenience.

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.