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
archuleta28
Resolver I
Resolver I

Date DAX - Consider dates up to 5th of next month? | Consider dates in current month?

Hi, I am into learning phase of DAX and need your urgent help!

 

I have a report that calculates Values and Quantity based on some conditions. User will select month from slicer so the data should populate for that selected month only.

 

Requirement 1:

I need to calculate Quantity and Values with this condition:  Date1 is not blank+ Order date is in current month + Custom number is blank

 

Now, how to write DAX for this logic that considers Order dates only for the selected month? For example, user has selected May month so this DAX should only consider Order dates from May month for above mentioned condition.

 

Requirement 2:

Here also, I need to calculate Quantity and Value with this condition: Date1 is not blank+ Consider ETD up to 5th of next month + Custom Number is blank

 

How to write DAX for this logic that considers ETD (dates) upto 5th of next month? For example, user has selected May month so this DAX should consider ETD from 5th May to 5th June i.e. 5th of the next month.  

 

Desired output in table for both conditions:

Qty Value
102000

 

Please let me know, any additional clarification is required from my end.  Any help would seriously be a big help! 

1 ACCEPTED SOLUTION

@archuleta28 , Try measure like

 Date1 is not blank+ Order date is in current month + Custom number is blank

 

calculate( Sum(Table[Qty]), filter(Table, not(isblank(Table[Date1])) && eomonth([Order Date],0) = eomonth(today(),0)  && isblank(Table[Custom Number]) ) )

 

 Date1 is not blank+ Consider ETD up to 5th of next month + Custom Number is blank

 

calculate( Sum(Table[Qty]), filter(Table, not(isblank(Table[Date1])) && eomonth([ETD],0) >= (eomonth(today(),-1) +1) && eomonth([ETD],0) <= (eomonth(today(),0) +5)   && isblank(Table[Custom Number]) ) )

 

View solution in original post

4 REPLIES 4
JunaidSayyed
Frequent Visitor

Great Job!!👏

archuleta28
Resolver I
Resolver I

Sample data is:

 

OrderDateSONoQTYDate1ETDCustom NumberValue
29-08-2022645108 02-09-20229O13084589
10-10-20221006935 10-12-20229O19454700
11-09-2022507135 06-10-20229O05523088
10-05-20227015 31-06-2022R91764030
10-08-202225238428-04-202214-09-20229O05882794
 791328-04-202207-04-20229O05884223
10-10-202227045.2 05-11-20229O04884257
10-11-202250735 16-12-20229O05524264
18-04-202212318130-05-202201-06-20229O05714288
11-06-20225000.115-06-202202-07-20229O08033198
08-07-202255249.108-06-202230-08-20229O06852138

@archuleta28 , Try measure like

 Date1 is not blank+ Order date is in current month + Custom number is blank

 

calculate( Sum(Table[Qty]), filter(Table, not(isblank(Table[Date1])) && eomonth([Order Date],0) = eomonth(today(),0)  && isblank(Table[Custom Number]) ) )

 

 Date1 is not blank+ Consider ETD up to 5th of next month + Custom Number is blank

 

calculate( Sum(Table[Qty]), filter(Table, not(isblank(Table[Date1])) && eomonth([ETD],0) >= (eomonth(today(),-1) +1) && eomonth([ETD],0) <= (eomonth(today(),0) +5)   && isblank(Table[Custom Number]) ) )

 

Thanks @amitchandak for your swift solution! Your first solution worked and I am working on the second solution you have provided. If anything comes up, I'll connect with you again 🙂

 

Your help is much appreciated!

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.