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.
I am trying to solve the below business logic using DAX:
I need a list of customer that has all
Nyka bags in last 18 mos
All orders in last 18 mos.
The date of last Nyka order
Who is the Sales rep on order
What is order status?
I have written a below DAX:
Table =
FILTER (
SELECTCOLUMNS (
FILTER ( Sales, Sales[Vendor_Name] = "NYKA" ),
"CUSTOMER NO", Sales[CUSTOMER_NO],
"Venodor Name", Sales[Vendor_Name],
"Order Date", Sales[ORDER_DATE],
"SALES REP", Sales[SALES_REP_ID],
"ORDER STATUS", Sales[ORDER_STATUS]
),
DATESINPERIOD (
'Sales'[ORDER_DATE],
MAX ( 'Sales'[ORDER_DATE] ),
-18,
MONTH
)
)
looks like my order date is not filtering correctly also, I have a doubt Like I transform the business logic using correct or optimized dax or not?
Need help or suggestion
Thanks,
Solved! Go to Solution.
Hi @amikm
You can use the following code to create a filtered table.
Table 2 =
SELECTCOLUMNS (
FILTER (
Sales,
Sales[Vendor_Name] = "NYKA"
&& Sales[ORDER_DATE] > EDATE ( MAX ( Sales[ORDER_DATE] ), -18 )
),
"CUSTOMER NO", Sales[CUSTOMER_NO],
"Venodor Name", Sales[Vendor_Name],
"Order Date", Sales[ORDER_DATE],
"SALES REP", Sales[SALES_REP_ID],
"ORDER STATUS", Sales[ORDER_STATUS]
)
You can use EDATE to get the date that is the indicated number of months before or after the start date.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
Hi @amikm
You can use the following code to create a filtered table.
Table 2 =
SELECTCOLUMNS (
FILTER (
Sales,
Sales[Vendor_Name] = "NYKA"
&& Sales[ORDER_DATE] > EDATE ( MAX ( Sales[ORDER_DATE] ), -18 )
),
"CUSTOMER NO", Sales[CUSTOMER_NO],
"Venodor Name", Sales[Vendor_Name],
"Order Date", Sales[ORDER_DATE],
"SALES REP", Sales[SALES_REP_ID],
"ORDER STATUS", Sales[ORDER_STATUS]
)
You can use EDATE to get the date that is the indicated number of months before or after the start date.
Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.
@amikm do you have a date table and is it marked as one? DATESINPERIOD is a time intelligence function which requires a date table
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
98 | |
80 | |
69 | |
59 |
User | Count |
---|---|
150 | |
119 | |
104 | |
87 | |
67 |