Forum Discussion

asteinrucke's avatar
asteinrucke
New Member
5 months ago
Solved

Filter a gadget for a certain date

Hi,
I have a table with data and certain dates (table 1). I have a date table too.
I want to set a filter for a gadget to just show the lastest date from table 1
I created a measure in table one to calculate the LastestDate.
I created a column in the date table to show 1 when the Date = LatestDate.
BUT, it shows 1 for all date values in Table 1.
I would expect only 1 for the actually latest date in table 1

  • Hi asteinrucke 

    I think I know why you are getting this but please to make sure show me the code of the column

     

    if it is something like

     

    my column = [my measure for last date]

     

    then you need to replace it with this code

     

    my column = CALCULATE ( [my measure for last date], REMOVEFILTERS ( ) )

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI

  • Hi asteinrucke 

    You're getting the same result because of context transition. Your measure returns the same date value as the current row date. Try:

    Latest Date Value =
    VAR _latestDateInTable =
        CALCULATE ( MAX ( Table1[Date] ), ALL ( Table1 ) )
    RETURN
        CALCULATE (
            [my aggregation],
            KEEPFILTERS ( DateTable[Date] = _latestDateInTable )
        )
    

5 Replies

  • Hi asteinrucke 

    I think I know why you are getting this but please to make sure show me the code of the column

     

    if it is something like

     

    my column = [my measure for last date]

     

    then you need to replace it with this code

     

    my column = CALCULATE ( [my measure for last date], REMOVEFILTERS ( ) )

     

    If this helped, please consider giving kudos and mark as a solution

    @me in replies or I'll lose your thread

    Want to check your DAX skills? Answer my biweekly DAX challenges on the kubisco Linkedin page

    Consider voting this Power BI idea

    Francesco Bergamaschi

    MBA, M.Eng, M.Econ, Professor of BI

  • Hi asteinrucke 

    You're getting the same result because of context transition. Your measure returns the same date value as the current row date. Try:

    Latest Date Value =
    VAR _latestDateInTable =
        CALCULATE ( MAX ( Table1[Date] ), ALL ( Table1 ) )
    RETURN
        CALCULATE (
            [my aggregation],
            KEEPFILTERS ( DateTable[Date] = _latestDateInTable )
        )
    
  • Hi,

    Please share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.

  • v-ssriganesh's avatar
    v-ssriganesh
    Icon for Community Support rankCommunity Support

    Hi asteinrucke,

    Thank you for posting your query in the Microsoft Fabric Community Forum, and thanks to FBergamaschi & danextian for sharing valuable insights.

     

    Could you please confirm if your query has been resolved by the provided solutions? This would be helpful for other members who may encounter similar issues.

     

    Thank you for being part of the Microsoft Fabric Community.

     

  • v-ssriganesh's avatar
    v-ssriganesh
    Icon for Community Support rankCommunity Support

    Hello asteinrucke,

    We hope you're doing well. Could you please confirm whether your issue has been resolved or if you're still facing challenges? Your update will be valuable to the community and may assist others with similar concerns.

    Thank you.