Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Get filtered date from other table

      I have a table with 2 date fileds financial date and transactional date and 3 cost amounts ,cost value,cost value adjust,cost value phy. The transaction date is in relation with date c...
  • Anonymous's avatar
    Anonymous
    5 years ago

    I created 2 measures as below.

     

    Inventory1 =

    VAR max_date=CALCULATE(MAX('Date'[Date]),ALL('Date'))

    VAR END_DATE=ENDOFMONTH('Date'[Date])

    VAR START_DATE=CALCULATE(min('Date'[Date]),ALL('Date'))

     

    RETURN

    CALCULATE(SUM('1 Inventory Value'[Cost Amount])+SUM('1 Inventory Value'[Cost Amount Adjustment]),FILTER('1 Inventory Value',('1 Inventory Value'[Financial Date]<=END_DATE && '1 Inventory Value'[Financial Date]>=START_DATE) && '1 Inventory Value'[Financial Date]<>DATE(1900,01,01)&& '1 Inventory Value'[Posting Type]

    in{"Physical","Financial"}),ALL('Date'))

    +

     

    CALCULATE(SUM('1 Inventory Value'[Cost Amount Physical]),FILTER('1 Inventory Value',('1 Inventory Value'[Financial Date]<max_date && '1 Inventory Value'[Financial Date]>=START_DATE) &&('1 Inventory Value'[Financial Date]>END_DATE || '1 Inventory Value'[Financial Date]=DATE(1900,01,01))&& '1 Inventory Value'[Posting Type]

    in{"Physical","Financial"}))

     

    Inventory2 =

    CALCULATE (

    [Inventory1],

    ALL ( 'Date'[Date]),

    datesbetween( 'Date'[Date], blank(), lastdate('Date'[Date]))

    )

    And i used Inventory2 and it worked perfectly. Thanks to everyone for giving some hints.