Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Help on DAX

Hi,

 

Can someone help me on DAX please ? I am trying get sales data for last 12 month (Rolling 12). I am tring to create a calculated column and as output I want when the PO is in rolling 12 months it will show only rolling 12 months sales data but when it is false it will show all the sales data in my model

 

Last12 =
IF (
'F_SALES_LINES'[PO_Date] <= EOMONTH ( NOW (), -12 )
|| 'F_SALES_LINES'[PO_Date] >= EOMONTH ( NOW (), 0 ),
FALSE(),
TRUE()
)
 
Outcome expected:
True = True
False = True + False
 
Thanking in advance !
 

3 Replies

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

    I think that you are close except I would do this:

     

    Last12 =
    IF (
    'F_SALES_LINES'[PO_Date] > EOMONTH ( NOW (), -13 )
    TRUE(),
    FALSE()
    )
     
    If this does not solve your problem, then there is not enough information presented. 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.
    • Anonymous's avatar
      Anonymous
      Not applicable

      Great Thanks Greg,

       

      How about when the condition does not meet and out come is False however when I filter in the report view I want to show the data as

      True = When condition is True data

      False = When condition is False (True + False togther will represent False)

       

      Any idea how I can get this please ?