Forum Discussion

birdie29's avatar
birdie29
Advocate II
9 years ago
Solved

Create a Column That Signifies the First Month's Transactions Based on Two Criteria

Hi Everyone   What I'm trying to create is column that signifies (ie Yes/No) the first month's transactions based on two criterias, the 'Project ID' and the 'Project Model'.   I've given an examp...
  • v-huizhn-msft's avatar
    9 years ago

    Hi birdie29

    You should calculate the min month in each Project ID and the Project Model’s value equals BASE. Then compare current transaction with the first transaction in previous month, and calculate the 'First Month's BASE Transactions' value using IF function. I reproduce the scenario and get expected result as follows.

    First, I create the calculated column Month and Min Month.

    Month = MONTH('Transaction'[Project Transaction Date])
    Min Month = CALCULATE(MIN('Transaction'[Month]),ALLEXCEPT('Transaction','Transaction'[Project ID]))


    Then I create a another column 'First Month's BASE Transactions. In the logicaltest of IF function, it will return “Yes” or “No” based on comparing the Month and Min Month. Please review the formula and screenshot below.

    First Month's BASE Transactions = IF('Transaction'[Project Model]="BASE",IF('Transaction'[Month]='Transaction'[Min Month],"Yes","No"),"No")

     



    Please note, the date in last row of your given sample data is 2016/11/31, while there are 30 day in November actually. So I change the date to 2016/11/30.

    If you have any question, please feel free to ask.

    Best Regards,
    Angelia