Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago

Report filter automatic result

Hello experts!

 

I need to filter the report to recognize the most recent date, then filter to only show results for the group of that date. For example...

 

The most recent event date on the database = 1/29/16 .  So I need the filter to ONLY show results for 6 days in event# 152.  This will prevent me from having to manually code the event# in the report each time a new event happens.  Any ideas?

 

Im a newbie to this, so a simple-mans answer would be much appreciated :-D

 

DATEEvent#Day of EventRevCat1RevCat2RevCat3RevCat4RevCat5
1/3/20161501$0.00 $0.00 $0.00 $0.00 $0.00 
1/3/20161502$0.00 $0.00 $0.00 $0.21 ($104.00)
1/4/20161503$50.00 $0.00 $0.00 $1,948.89 $308.50 
1/5/20161511$0.00 $0.00 $0.00 $0.00 $0.00 
1/6/20161512$0.00 $0.00 $0.00 $779.61 $307.00 
1/7/20161513$0.00 $0.00 $413.00 $897.78 $1,011.00 
1/8/20161514$0.00 $0.00 $0.00 $2,175.40 ($618.00)
1/9/20161515$0.00 $1,040.50 $0.00 ($21.06)$614.50 
1/10/20161516$28.50 $0.00 $0.00 $445.66 $526.00 
1/11/20161521$0.00 $0.00 $0.00 $810.06 $662.50 
1/12/20161522$360.50 $0.00 $0.00 $344.23 $1,268.00 
1/27/20161523$0.00 $0.00 $0.00 $720.20 $1,301.00 
1/27/20161524$0.00 $0.00 $0.00 $956.91 $643.50 
1/28/20161525$0.00 $0.00 $287.00 $1,158.48 $2,290.50 
1/29/20161526$198.00 $21,876.00 $276.00 $1,335.29 $726.00 

9 Replies

  • Sean's avatar
    Sean
    Community Champion

    Anonymous Create the 2 Measures and then replace [Date] in your Table Visual with Last Date and [Event#] with Last Event#

     

    Last Date = 
    CALCULATE ( LASTDATE ( 'Table'[DATE] ), ALL ( 'Table' ) )
    
    Last Event# =
    CALCULATE (
        VALUES ( 'Table'[Event#] ),
        LASTDATE ( 'Table'[DATE] ),
        ALL ( 'Table' )
    )
    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks!  This works to create the data for the most recent Event# recorded (thakn you!!).  However, the system won't let me use this Measure as a Report Filter.  (can't drag it into the report filter box).  Any ideas?

      • Sean's avatar
        Sean
        Community Champion

        Last Date formula will work as a column too...

  • v-caliao-msft's avatar
    v-caliao-msft
    Microsoft Employee

    Hi Pchapple,

     

    According to your description, you need to only show most recent event date with add any filter, right?

     

    I have tested it on my local environment, there is no any Minimum and Maximum option for a date value.

    So you need to create another table to get only the lastest date for each event, and then use the new created table to create visuals.

    Create a column in the original table
    LatestDate = CALCULATE(MAX(Latest[DATE]),ALLEXCEPT(Latest,Latest[Event#]))
    Then create a new table
    LatestEvent = SUMMARIZE(Latest,Latest[Event#])
    Add those columns to the new created table.
    LatestDate = LOOKUPVALUE(Latest[LatestDate],Latest[Event#],LatestEvent[Event#])
    RevCat1 = LOOKUPVALUE(Latest[RevCat1],Latest[DATE],LatestEvent[LatestDate],Latest[Event#],LatestEvent[Event#])
    RevCat2 = LOOKUPVALUE(Latest[RevCat2],Latest[DATE],LatestEvent[LatestDate],Latest[Event#],LatestEvent[Event#])
    RevCat3 = LOOKUPVALUE(Latest[RevCat3],Latest[DATE],LatestEvent[LatestDate],Latest[Event#],LatestEvent[Event#])
    RevCat4 = LOOKUPVALUE(Latest[RevCat4],Latest[DATE],LatestEvent[LatestDate],Latest[Event#],LatestEvent[Event#])
    RevCat5 = LOOKUPVALUE(Latest[RevCat5],Latest[DATE],LatestEvent[LatestDate],Latest[Event#],LatestEvent[Event#])

     

     

    Regards,

    Charlie Liao

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks v-caliao-msft

       

      When you are referecning the table Latest... for example...

       

      LatestDate = CALCULATE(MAX(Latest[DATE]),ALLEXCEPT(Latest,Latest[Event#]))

       

      What table are you refering to?  Is it the original table? When I try to create the new column in the original table as you described, its giving me an error.  

       

      Sorry for the newbie questions...

       

      Paul

      • v-caliao-msft's avatar
        v-caliao-msft
        Microsoft Employee

        Hi Pchapple,

         

        Yes, create calculated column in the original table. Please share us the error message, so that we can make further analysis.

         

        Regards,

        Charlie Liao