Forum Discussion

shamnadkalathil's avatar
shamnadkalathil
Frequent Visitor
2 years ago
Solved

Show values between dates selection

Hi all,

 

I have a report page which shows Item sales details. Now I want to map cost of the item on each line.

 

The Cost table is like as follows:

ItemNumberPostingDateUoMCost
300238302/01/2022PC0.090
300238305/01/2022PC0.095
300238312/01/2022PC0.100
300238313/01/2022PC0.960

 

If I run the Sales report from 02/01/2022 to 12/01/2022, the cost for the aboive item should show as

from 02/01/2022 to 04/01/2022:  Cost: 0.090

from 05/01/2022 to 11/01/2022: Cost: 0.095

on 12/01/2022: the cost is 0.100

6 Replies

  • you can create a measure

     

    Measure =
    VAR _date=max('date'[Date])
    VAR _date2=maxx(FILTER('Table','Table'[PostingDate]<=_date),'Table'[PostingDate])
    return maxx(FILTER('Table','Table'[PostingDate]=_date2),'Table'[Cost])
     
     
    pls see the attachment below
  • ryan_mayu  thank you for the quick response. my requirement is to show the cost price on respective sales line.

     

    DateItemQuantityCostTotal CostSelling PriceTotalMargin
    02/01/2024300238320.090.180.1150.230.05
    03/01/2024300238310.090.090.1150.1150.025
    05/01/20243002383100.0950.950.1151.150.2
    10/01/2024300238350.0950.4750.1150.5750.1
    12/01/2024300238320.10.20.1150.230.03
    • ryan_mayu's avatar
      ryan_mayu
      Super User

      i forgot to delete the visual. The output is the 'Merge' table.