Forum Discussion

Kevin0001's avatar
Kevin0001
Frequent Visitor
1 year ago
Solved

Creating Month Periods

I am working on a project in PowerBI and I want to create a Period Column in my Table. 
In this column there are supposed to be 3 categories: P4, P8 and P12 (the numbers correlate to the amount of months I want to take in the period).
P4 should be January till April,
P8 should be January till August and
P12 should be January till December

So far I have the following:

Period =
SWITCH(
    TRUE(),
    MONTH([Date]) <= 4, "P4",
    MONTH([Date]) <= 8, "P8",
    MONTH([Date]) <= 12, "P12",
    BLANK()

)

The problem with this, is that it does the following:
P4 is January till April, 
P8 is May till August and
P12 is September till December.

Does anyone know a sollution?

  • Hello Kevin0001 , 

     

    Not sure if you are looking for same logic(P4,P8 and P12) in one single column which will be impossible because if the first condition like till Jan to Apr is P4 has met then how can  P12 with jan to Dec can appear in same column..

     

    If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

     

    Thank You

    Dharmendar S

1 Reply

  • dharmendars007's avatar
    dharmendars007
    Memorable Member

    Hello Kevin0001 , 

     

    Not sure if you are looking for same logic(P4,P8 and P12) in one single column which will be impossible because if the first condition like till Jan to Apr is P4 has met then how can  P12 with jan to Dec can appear in same column..

     

    If you find this helpful , please mark it as solution and Your Kudos are much appreciated!

     

    Thank You

    Dharmendar S