Forum Discussion
Help with measurment creation :)
- 8 months ago
Hi Theo321
When there is an error on the return statement, it is almost always highlighting an issue in the filter statement. It could be as simple as DATEVALUE not being required, as your date column is already in the correct format. There may be blank dates throwing it off. Try this updated DAX.
Rows – Last 10 Days, Assigned, A/C, D/F := VAR FilteredRows = FILTER ( 'Historical Data', NOT ISBLANK ( 'Historical Data'[Delivered on] ) && VAR RowDate = 'Historical Data'[Delivered on] VAR StartLast10Days = EOMONTH ( RowDate, 0 ) - 9 VAR ModelClean = UPPER ( TRIM ( 'Historical Data'[Model] ) ) VAR SubModelClean = UPPER ( TRIM ( 'Historical Data'[subModel] ) ) RETURN RowDate >= StartLast10Days && NOT ISBLANK ( 'Historical Data'[Assignment] ) && ModelClean IN { "A", "C" } && SubModelClean IN { "D", "F" } ) RETURN COUNTROWS ( FilteredRows )If this doesn't work, try an alternative using CALCULATE:
Rows – Last 10 Days, Assigned, A/C, D/F := CALCULATE ( COUNTROWS ( 'Historical Data' ), NOT ISBLANK ( 'Historical Data'[Assignment] ), FILTER ( 'Historical Data', UPPER ( TRIM ( 'Historical Data'[Model] ) ) IN { "A", "C" } && UPPER ( TRIM ( 'Historical Data'[subModel] ) ) IN { "D", "F" } ), FILTER ( 'Historical Data', NOT ISBLANK ( 'Historical Data'[Delivered on] ) && VAR RowDate = 'Historical Data'[Delivered on] RETURN RowDate >= EOMONTH ( RowDate, 0 ) - 9 ) )If you still have trouble, please consider sharing the pbix.
--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
Hi Theo321
Please give this a try:
Rows – Last 10 Days, Assigned, A/C, D/F :=
VAR FilteredRows =
FILTER (
'Historical Data',
-- Ensure Delivered on exists
NOT ISBLANK ( 'Historical Data'[Delivered on] ) &&
-- Last 10 days of the row's month
DATEVALUE ( 'Historical Data'[Delivered on] ) >=
EOMONTH ( DATEVALUE ( 'Historical Data'[Delivered on] ), 0 ) - 9 &&
-- Assignment not blank
NOT ISBLANK ( 'Historical Data'[Assignment] ) &&
-- Model is A or C (cleaned for spaces/case)
UPPER ( TRIM ( 'Historical Data'[Model] ) ) IN { "A", "C" } &&
-- subModel is D or F (cleaned for spaces/case)
UPPER ( TRIM ( 'Historical Data'[subModel] ) ) IN { "D", "F" }
)
RETURN
COUNTROWS ( FilteredRows )--------------------------------
I hope this helps, please give kudos and mark as solved if it does!
Connect with me on LinkedIn.
Subscribe to my YouTube channel for Fabric/Power Platform related content!
Hello wardy912
Onlu lucky luke was so fast 🤣
Thaks for your prompt responce, I will give it a try.