Forum Discussion
Help with measurment creation :)
- 10 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
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!