Forum Discussion

Anithalakshmi's avatar
Anithalakshmi
Frequent Visitor
8 years ago
Solved

Break months between dates as Columns

The data I have is

 

 

EmpIDNameProjectStart DateEnd DateEffort%
1Name1P101-02-201829-05-2018100
2Name5P201-01-201801-04-201860
3Name2P301-04-201801-05-201870
4Name2P401-01-201803-04-201830
5Name5P503-01-201804-08-201840

PowerBI dashboard.

I Need the output breakup into Months, with conditional formatting in color code based on effort %.

 

EmpIDNameProjectStart DateEnd DateEffort%JanFebMarAprMayJunJulTill Dec
1Name1P101-02-201829-05-2018100 100100100100   
2Name5P201-01-201801-04-20186060606060    
3Name2P301-04-201801-05-201870   7070   
4Name2P401-01-201803-04-20183030303030    
5Name5P503-01-201804-08-20184040404040404040 

 

  • Not sure if you want to do this in M or DAX. In DAX you can create calculated columns with the following formula:

     

    Jan = VAR MyMonth = 1
    RETURN IF(MONTH([Start Date])<=MyMonth && MONTH([End Date])>=MyMonth,[Effort%],BLANK())

    Just change the column name and the MyMonth value for each column.

2 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Not sure if you want to do this in M or DAX. In DAX you can create calculated columns with the following formula:

     

    Jan = VAR MyMonth = 1
    RETURN IF(MONTH([Start Date])<=MyMonth && MONTH([End Date])>=MyMonth,[Effort%],BLANK())

    Just change the column name and the MyMonth value for each column.

    • Anithalakshmi's avatar
      Anithalakshmi
      Frequent Visitor

      my startdate is in Dec 2017 and enddate is in Mar2018

      The date comparision fails for dec where the month is 12.Should I use datediff function? Not sure how