Forum Discussion

hani1711's avatar
hani1711
Regular Visitor
2 years ago
Solved

How to filter data from date table and another table?

I have date table and table1 contain date, type, and qty and filter  i want to filter the data with type Negative Adjmt. and Consumption with the range from earlier data from selected ...
  • TomMartens's avatar
    2 years ago

    Hey hani1711 ,

     

    at a first glance I can not see what is not working, except that the measure seems too complicated.

     

    If the slicers of year, month, day are derived from the DimDate table you can get the 
    var _selecteddate
    like so:

    var _selecteddate = maxx(values(DimDate[FullDateAlternateKey]), DimDate[FullDateAlternateKey])

    I use the table iterator function MAXX in case the slicers allow multi-selection.

    In the CALCULATE I would use this:

    CALCULATE(
        [Qty]
        ,ALL(DimDate)
        ,DATESBETWEE(DimDate[FullDateAlternateKey],_mindate ,_selecteddate)
        ,table[Type] IN {"Negative Adjmt.", "Consumption"}
    )

     

    If this does not help to tackle your challenge, consider creating a pbix file that contains sample data but reflects your semantic model (tables, relationships, calculated columns, and measures), upload the pbix file to OneDrive, Google Drive, or Dropbox and share the link.

    Do not forget to describe the expected result based on the sample data you provide.

     

    Regards,

    Tom