Forum Discussion

LuchiBella's avatar
LuchiBella
New Member
3 years ago

Adding Dates to a calculated measure

I have this formula but the FROM DATE and TO DATE is not correct as its not displaying any numbers and its supposed to. I need a way to make it work. Thanks in advance

 

%LM Invoice Based Discount = CALCULATE(MAX('LM IBD Ranges'[% discount]),
FILTER('LM IBD Ranges',
//'IBD Ranges'[Country] = SELECTEDVALUE('3PL Payment'[Country]) &&
'LM IBD Ranges'[Service provider] = SELECTEDVALUE('3PL Payment'[Service Provider]) &&
'LM IBD Ranges'[Min invoice amount] <= SUM('3PL Payment'[LCY - Total Payment]) &&
'LM IBD Ranges'[Max invoice amount] > SUM('3PL Payment'[LCY - Total Payment]) &&
'LM IBD Ranges'[From Date] >= MIN('3PL Payment'[Close Date]) &&
'LM IBD Ranges'[To Date] <= MAX('3PL Payment'[Close Date])))

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    LuchiBella Sorry, having trouble following, can you post sample data as text and expected output?
    Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

    Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

    The most important parts are:
    1. Sample data as text, use the table tool in the editing bar
    2. Expected output from sample data
    3. Explanation in words of how to get from 1. to 2.

    • LuchiBella's avatar
      LuchiBella
      New Member

      I have two tables named LM IBD Ranges and 3PL Payment

       

      LM IBD Ranges

      Service provider  % discount   Min invoice amount  Max invoice amount  From Date           To Date

      ABC                       3%               50,000                        100,000                     Jan-1-2023

       

      To Date(is Today)

      3PL Payment

      Service provider    LCY - Total Payment   Close Date

      ABC                        5,000,000                    Aug-7-2023

       

      I want to get %LM Invoice Based Discount from the above information but my formula is not displaying any output.

       

      I don't know if what I added will help you understand what I need.