Forum Discussion

AndrejZevzikov's avatar
3 years ago
Solved

Measure Ignoring sate slicer

Hi, Guys
I have some problem with ignoring date slicer filtering and will be appreciate for any help. To make it easier I create some sample .pbix file that imitates my problem. I has data like this: 

and if in my report has wide date slicer range it's works fine: 

but problem is even if I select date for example from march 1 to march 12 I want still see those data even if no sales was in that period but company title filter and date max filter should still work. For example with that filter :

result should be: 

with filters like what: 

result should be: 

as we see it should work like ignoring min date filter, but all ather filter should work as by default even max date filter. Now my measure looks like that 

Measure =
VAR maxDate = MAX('Calendar'[Date])

VAR exactDate = CALCULATE(MAX(sales[Date]),
FILTER(sales,
maxDate>=sales[Date] &&
sales[deleted] = "0"))
 
VAR result = CALCULATE(MAX(sales[sales before]),
FILTER(sales,
exactDate=sales[Date] &&
sales[deleted] = "0"))
 
return result
 
I gues in result variable I need some remove filter ant all functions but i tried a lot combinations and its dont seem right, will be glad if some of you has any ideas :D.

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi AndrejZevzikov ,

    I have created a simple sample, please refer to my pbix file to see if it helps you.

    Create 2 measures.

    date_m =
    VAR _maxdate =
        MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
    RETURN
        IF ( MAX ( sales[Date] ) <= _maxdate, 1, BLANK () )
    
    result =
    CALCULATE (
        MAX ( sales[sales before] ),
        FILTER (
            ALL ( sales ),
            sales[Company id] = SELECTEDVALUE ( sales[Company id] )
                && sales[deleted] = "0"
                && [date_m] = 1
        )
    )
    

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi AndrejZevzikov ,

    I have created a simple sample, please refer to my pbix file to see if it helps you.

    Create 2 measures.

    date_m =
    VAR _maxdate =
        MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] )
    RETURN
        IF ( MAX ( sales[Date] ) <= _maxdate, 1, BLANK () )
    
    result =
    CALCULATE (
        MAX ( sales[sales before] ),
        FILTER (
            ALL ( sales ),
            sales[Company id] = SELECTEDVALUE ( sales[Company id] )
                && sales[deleted] = "0"
                && [date_m] = 1
        )
    )
    

     

    How to Get Your Question Answered Quickly 

     

    If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

     

    Best Regards
    Community Support Team _ Polly

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.