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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Table Problem

I have a database is configured like this:

 

ProjectLatestStageS1S2
P1S101/01/2019-
P2S201/01/201901/02/2019

 

I unpivot the S1 and S2 columns:

 

ProjectLatestStageStageStageDate
P1S1S104/07/2019
P2S2S107/06/2019
P2S2S228/06/2019

 

I created a calculated column where it shows the total amount that each project stays in the stage:

 

ProjectLatestStageStageStageDateDaysInStage
P1S1S104/07/201914
P2S2S107/06/201921
P2S2S228/06/201920

 

My problem: I'm trying to create a table where I show the project, the stage and the number of days that the project is in the stage:

 

ProjectLatestStageDaysInStage
P1S114
P2S220

 

But when I create that table, it show two lines for P2. Showing the same stage, but with diferent values for DaysInStage.

 

ProjectLatestStageDaysInStage
P1S114
P2S220
P2S221

 

Any idea about how can I solve this?

 

Best Regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I think I've found a solution, but I do not know if it's the best.

 

First I created 4 measures to return the value of DaysInStage according to LatestStage

 

Days in S1 = CALCULATE(SUM(TabProjects[DAYS IN STAGE]);FILTER(TabProjects;TabProjects[STAGE]="S1"))

And then I used the HASONEFILTER function combined with SWITCH

 

TEST = IF(
    HASONEFILTER(TabProjects[LATEST STAGE]);
    SWITCH(
        VALUES(TabProjects[LATEST STAGE]);
        "S1";[Days in S1];
        "S2";[Days in S2]))

Apparently, it works...

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

I think I've found a solution, but I do not know if it's the best.

 

First I created 4 measures to return the value of DaysInStage according to LatestStage

 

Days in S1 = CALCULATE(SUM(TabProjects[DAYS IN STAGE]);FILTER(TabProjects;TabProjects[STAGE]="S1"))

And then I used the HASONEFILTER function combined with SWITCH

 

TEST = IF(
    HASONEFILTER(TabProjects[LATEST STAGE]);
    SWITCH(
        VALUES(TabProjects[LATEST STAGE]);
        "S1";[Days in S1];
        "S2";[Days in S2]))

Apparently, it works...

Anonymous
Not applicable

Hi @Anonymous ,

 

I am little confuse with your requirements.

Could you be more specific? 

 

When I try to input the data you provided in the table it looks loke this without nay issue.

 

Capture 5.PNG

 

Thanks,

Tejaswi

Anonymous
Not applicable

Hello @Anonymous 

 

The Project P2 is the S2 stage, but only for 21 days, not 41.

 

This happens because the DaysInStage value is with the SUM option enabled.

 

Sem título.jpg

But if I click on "Don't summarize", the table shows the two lines of P2. What I need is that only the project line related to the current stage of it appears.

 

Capturar.JPG

Best Regards,

 

Gustavo

Anonymous
Not applicable

Hi @Anonymous ,

 

I don't know if this solutions will work for you.

I added a Index column in a query editor and converted it to Text.

 

Than I added this Index column ina Tabe visual and in Visual level filter I took out the value 2 which was P2, S2 and 20.

 

My output looks like this:

 

Capture 56.PNG

 

Thanks,

Tejaswi

Anonymous
Not applicable

If my table were simple, it would work. But my project list has more than 10 projects. And in reality they have 8 stages, not 2.

Smiley Sad

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.