Forum Discussion

ALDOBES's avatar
ALDOBES
Frequent Visitor
3 years ago

Dax Measure - Ignore Selectedvalue[date], then filter [date2] on selectedvalue[date]

I have a measure similar to the below (context changed)
However it doesn't work, it just returns all rows of the table by the selectedvalue[ReceivedDate] still.

I need it to create a linegraph showing
line A: the total number of 'sausages' received in a period 
line B: the total number of 'sausages' 'reallyratherbadlyburnt' in a period


Dead Sausages (Use Received Date as Cooked Date) =
VAR SelectedFromDttm =
    SELECTEDVALUE ( 'DD Log'[Received Date] )
RETURN
    CALCULATE (
        COUNTROWS ( 'DD Log' ),
        FILTER ( ALL ( 'DD Log'[ReceivedDate] ), 'DD Log'[CookedDate] = SelectedFromDttm ),
        'DD Log'[SausageStatus] = "reallyratherbadlyburnt"
    )


Also Tried 


Dead Sausages (Use Received Date as Cooked Date) =
VAR SelectedFromDttm =
    SELECTEDVALUE ( 'DD Log'[Received Date] )
RETURN
    CALCULATE (
        COUNTROWS ( 'DD Log' ),
        FILTER ( ALL ( 'DD Log'[CookedDate] ), 'DD Log'[CookedDate] = SelectedFromDttm ),
        'DD Log'[SausageStatus] = "reallyratherbadlyburnt"
    )

 

and

 

Dead Sausages (Use Received Date as Cooked Date) =
VAR SelectedFromDttm =
    SELECTEDVALUE ( 'DD Log'[Received Date] )
RETURN
    CALCULATE (
        COUNTROWS ( 'DD Log' ),
        FILTER ( ALL ( 'DD Log'), 'DD Log'[CookedDate] = SelectedFromDttm ),
        'DD Log'[SausageStatus] = "reallyratherbadlyburnt"
    )

 

Same results.

 

Please help.

2 Replies

  • Might be easier to help  if you could provide sample data and show the expected result.

  • Hi,

    This should work. 

    1. Create a Calendar Table
    2. Create a relationship (Many to One and SIngle) from The Cooked Date column to the Date column of the Calendar Table
    3. Create a Date slicer from the Calendar Table and select any date/date range
    4. Write this measure

    Measure = COUNTROWS ( 'DD Log' )

    Hope this helps.