Forum Discussion

Anshenterprices's avatar
4 years ago

Display recent max date and values in matrix table while selection of any date from date slicer

Hi Team,

 

Source Data

DatecategoryValueType
10/3/2021Commodity50Broker
10/3/2021equity10Broker
10/2/2021equity30Broker
10/2/2021Commodity30Broker
10/1/2021Commodity20Online
10/1/2021equity30Online
9/30/2021Commodity34Broker
9/30/2021equity56Broker
9/30/2021Commodity45Online
9/30/2021equity50Online
9/26/2021equity20Broker
9/26/2021Commodity30Broker
9/22/2021equity12Online
9/22/2021Commodity14Online

 


I have date Slicer 
once i select any date it should display table like below

categoryBrokerOnline
Commodity5020
equity1030
   

 


Requirement:- eg. if user select 3rd oct 2021 from the date slicer then it should display broker data of 3rd oct but online data with any lastest date i.e. 1st oct of value 

if user select 26th sep 2021 then it should display data of broker data but online data of lastest date means 22nd sept value

if user select 1st oct 2021 then it should display data of broker data of 1st oct but online data of lastest date means 30th sept value not selected date value for online

Need your help amitchandak  Greg_Deckler 
Thanks,


 

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anshenterprices ,

    I created a sample pbix file(see attachment) for you, please check whether that is what you want.

    1. Create a date dimension table and apply the date field as slicer option

    Date = CALENDAR ( MIN ( 'Table'[Date] ), MAX ( 'Table'[Date] ))

    2. Create two measures as below to get the value from latest recent date

    Measure = 
    VAR _seldate =
        SELECTEDVALUE ( 'Date'[Date] )
    VAR _recentdate =
        CALCULATE (
            MAX ( 'Table'[Date] ),
            FILTER (
                ALLSELECTED ( 'Table' ),
                'Table'[Date] <= _seldate
                    && 'Table'[Type] = SELECTEDVALUE ( 'Table'[Type] )
            )
        )
    RETURN
        CALCULATE (
            SUM ( 'Table'[Value] ),
            FILTER ( 'Table', 'Table'[Date] = _recentdate )
        )
    NValue = SUMX(VALUES('Table'[Type]),[Measure])

     

    Best Regards

    • Anshenterprices's avatar
      Anshenterprices
      Helper IV

      Anonymous if user select 1st oct 2021 then it should display data of broker data of 1st oct but online data of lastest date means 30th sept value not selected date value for online

      • Anshenterprices's avatar
        Anshenterprices
        Helper IV

        Anonymous 



        Sample data:-

         
        CategorySub CategoryValueDateCDateType
        CommodityT119.439/29/202129-Sep-21Broker
        FNOMF10.59/29/202129-Sep-21Broker
        FNOB13.959/29/202129-Sep-21Broker
        FNOc10.479/29/202129-Sep-21Broker
        Equityash179/29/202129-Sep-21Broker
        Equityab149/29/202129-Sep-21Broker
        Equityte131.419/29/202129-Sep-21Broker
        FNOs10.759/29/202129-Sep-21Broker
        CommodityT119.459/30/202130-Sep-21Broker
        FNOMF10.59/30/202130-Sep-21Broker
        FNOB13.949/30/202130-Sep-21Broker
        FNOc11.229/30/202130-Sep-21Broker
        FNOU1-0.759/30/202130-Sep-21Broker
        Equityash17.789/30/202130-Sep-21Broker
        Equityab13.999/30/202130-Sep-21Broker
        Equityte131.419/30/202130-Sep-21Broker
        FNOs109/30/202130-Sep-21Broker
        CommodityT119.6510/1/20211-Oct-21Broker
        FNOMF10.5110/1/20211-Oct-21Broker
        FNOB13.9810/1/20211-Oct-21Broker
        FNOc11.210/1/20211-Oct-21Broker
        FNOU1-0.7510/1/20211-Oct-21Broker
        Equityash17.8210/1/20211-Oct-21Broker
        Equityab1410/1/20211-Oct-21Broker
        Equityte131.3610/1/20211-Oct-21Broker
        CommodityT119.6910/4/20214-Oct-21Broker
        FNOMF10.5110/4/20214-Oct-21Broker
        FNOB13.9610/4/20214-Oct-21Broker
        FNOc10.5410/4/20214-Oct-21Broker
        FNOU1-3.0110/4/20214-Oct-21Broker
        Equityash17.7710/4/20214-Oct-21Broker
        Equityab11.9910/4/20214-Oct-21Broker
        Equityte134.3910/4/20214-Oct-21Broker
        FNOs13.0410/4/20214-Oct-21Broker
        CommodityT119.4510/5/20215-Oct-21Broker
        FNOMF10.5110/5/20215-Oct-21Broker
        FNOB13.9810/5/20215-Oct-21Broker
        FNOc10.7210/5/20215-Oct-21Broker
        FNOU1-3.0110/5/20215-Oct-21Broker
        Equityash17.7110/5/20215-Oct-21Broker
        Equityab11.9910/5/20215-Oct-21Broker
        Equityte134.4910/5/20215-Oct-21Broker
        FNOs13.0210/5/20215-Oct-21Broker
        Equityab10.0408219/29/202129-Sep-21Online
        Equityab10.02082110/1/20211-Oct-21Online
        Equityash10.0752299/29/202129-Sep-21Online
        Equityash10.07522910/1/20211-Oct-21Online
        Equityte10.3316739/29/202129-Sep-21Online
        Equityte10.36167310/1/20211-Oct-21Online
        CommodityT10.1992039/29/202129-Sep-21Online
        CommodityT10.19920310/1/20211-Oct-21Online
        FNOB10.0283579/29/202129-Sep-21Online
        FNOB10.02835710/1/20211-Oct-21Online
        FNOMF10.004989/29/202129-Sep-21Online
        FNOMF10.0049810/1/20211-Oct-21Online
         
         

         



        2 measures:-

        Broker_New1 =
        SUMX (
        FILTER (
        'Table (3)',
        [Type] = "Broker"
        && 'Table (3)'[Date]= SELECTEDVALUE ( 'Table (3)'[Date] )
        ),
        'Table (3)'[Value]
        )

        Online_new1 =
        VAR a =
        MAXX (
        FILTER (
        ALL ( 'Table (3)' ),
        [Date] < SELECTEDVALUE ( 'Table (3)'[Date] )
        && [Type] = "Online"
        ),
        [Date]
        )
        RETURN
        SUMX (
        FILTER (
        ALL ( 'Table (3)' ),
        [Date] = a
        && [Type] = "Online"
        && [category] = SELECTEDVALUE ( 'Table (3)'[category] )

        && [Sub Category] = SELECTEDVALUE ( 'Table (3)'[Sub Category] )
        ),
        'Table (3)'[Value]
        )

        In some cases Sub Total showing Blank, i need a row subtotal of each category