Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anshenterprices
Helper IV
Helper IV

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 4
v-yiruan-msft
Community Support
Community Support

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])

yingyinr_0-1633938861532.png

 

Best Regards

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

@v-yiruan-msft 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

Hi @Anshenterprices ,

I'm sorry I'm confused about your expected result. According to the data you provided, when you select 1st oct 2021, there is only online data for 1st oct 2021 as shown below and there is no data for 10.1 borker...

yingyinr_0-1634024890390.png

So, could you please share the results you are looking for with actual examples. For example, what kind of data should visual display when each date is selected? For example:

Selected date: 1st oct 2021

Expected result:

category Broker Online
Commodity ? ?
equity ? ?

Best Regards

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

@v-yiruan-msft 



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

Anshenterprices_0-1634010321789.png

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.