Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!

Reply
royalty123
Regular Visitor

Need Help with Project Types

Hi, I have two types of projects 1. Agile 2. Software. The below formulas apply to both the Project types. Initially our projects took 3 months to complete but lately it was taking 6 months so I wanted to show the 3 months data in 6 months and took an expert's help from the community. But the issue now I'm facing is I want to show the data from 3 months to 6 months for Agile projects only not for Software projects since they take 3 months to complete, so the old formula (3 months formula) works fine for Software projects. Could anyone please suggest if there is any DAX formula or IF condition that we can apply to show 6 months formula for Agile and 3 months formula for Software. For Agile projects we take 60 Hours and for Software projects we take 6 hrs to complete

 

FYI - I need to show both Agile and Software projects types in the same stacked column chart so I cannot add two different tables in PowerBI and need one combined formula to suffice both the needs. 

 

Sample table for your reference

 

IdTitleSupply type per_ProjectsStatusLeadTimeHoursTotalDatehoursweekhourspending1nextmonth1hourspending2nextmonth2workhours1workhours2workhours3Date Completed
1AStrageticAgileactive12601/9/20245402/9/2024 0:00203/9/2024 0:00101010 
2BOperationalSoftwareactive162/15/2024133/15/202434/15/2024330 

 

3 months Formula:

 

WORKS = UNION(
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[Date].[Date])),WORKSMONTH[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects],"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[Date].[Date],
                    IF(WORKSMONTH[HoursTotal]>0,
                        IF(WORKSMONTH[HoursTotal]<=WORKSMONTH[hoursweek]*4,WORKSMONTH[HoursTotal],WORKSMONTH[hoursweek]*4), 
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth1].[Date])),WORKSMONTH[nextmonth1].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects],"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth1].[Date],
                    IF(WORKSMONTH[hourspending1]>0,
                        IF(WORKSMONTH[hourspending1]<=WORKSMONTH[hoursweek]*4,WORKSMONTH[hourspending1],WORKSMONTH[hoursweek]*4),
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth2].[Date])),WORKSMONTH[nextmonth2].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects],"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth2].[Date],
                    IF(WORKSMONTH[hourspending2]>0,
                        IF(WORKSMONTH[hourspending2]<=WORKSMONTH[hoursweek]*4,WORKSMONTH[hourspending2],WORKSMONTH[hoursweek]*4),
                    BLANK()),
                BLANK()))
    )
 
6 months Formula after expert's advise I added the same formula for next 3 months:
 
WORKS = UNION(
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[Date].[Date])),WORKSMONTH[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[Date].[Date],
                    IF(WORKSMONTH[HoursTotal]>0,
                        IF(WORKSMONTH[HoursTotal]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[HoursTotal],WORKSMONTH[hoursweek]*2),
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth1].[Date])),WORKSMONTH[nextmonth1].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth1].[Date],
                    IF(WORKSMONTH[hourspending1]>0,
                        IF(WORKSMONTH[hourspending1]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[hourspending1],WORKSMONTH[hoursweek]*2),
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth2].[Date])),WORKSMONTH[nextmonth2].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth2].[Date],
                    IF(WORKSMONTH[hourspending2]>0,
                        IF(WORKSMONTH[hourspending2]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[hourspending2],WORKSMONTH[hoursweek]*2),
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth3].[Date])),WORKSMONTH[nextmonth3].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth3].[Date],
                    IF(WORKSMONTH[hourspending3]>0,
                        IF(WORKSMONTH[hourspending3]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[hourspending3],WORKSMONTH[hoursweek]*2),
                    BLANK()),
                BLANK())),
   SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth4].[Date])),WORKSMONTH[nextmonth4].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth4].[Date],
                    IF(WORKSMONTH[hourspending4]>0,
                        IF(WORKSMONTH[hourspending4]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[hourspending4],WORKSMONTH[hoursweek]*2),
                    BLANK()),
                BLANK())),
    SELECTCOLUMNS(WORKSMONTH,"m",IF(NOT(ISBLANK(WORKSMONTH[nextmonth5].[Date])),WORKSMONTH[nextmonth5].[Date],BLANK()),
        "ID",WORKSMONTH[Id],"Title",WORKSMONTH[Title],"Status",WORKSMONTH[Status],"ProjectType",WORKSMONTH[Projects,"Supply",WORKSMONTH[Supply type per_],
        "value",IF(WORKSMONTH[nextmonth4].[Date],
                    IF(WORKSMONTH[hourspending5]>0,
                        IF(WORKSMONTH[hourspending5]<=WORKSMONTH[hoursweek]*2,WORKSMONTH[hourspending5],WORKSMONTH[hoursweek]*2),
                    BLANK()))
 
Thanks in advance!!
 
1 REPLY 1
johnbasha33
Super User
Super User

@royalty123  we can work it out with a dynamic calculation.

check and let us know if it works.

 

calculated column: 
LeadTime =
IF ( Projects[ProjectType] = "Agile", 12, 3 )

use this in the visual.

 

 

Did I answer your question? Mark my post as a solution! Appreciate your Kudos !!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! It's time to submit your entry.

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.