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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Abdel_BCN
Frequent Visitor

Insert new calculated row

Hi community, 

 

I have a calculated table like this:

for each date and project type "Fix Price", I have a calculated loss. In this case, for the project of the second line I have a calculated loss of 20h.

Loses.JPG

The donut chart by billability would be.

Billability 3.JPG

 

 

 

 

 

 

 

 

 

My goal is to correct this donut chart by taking into account the calculated losses, so the table should be looking like this:

 

Billability 4.JPG

 

Billability 5.JPG

 

The total hours in this case did not change, it still at 100h.

 

I attached the pbi file

thanks.

1 ACCEPTED SOLUTION
Abdel_BCN
Frequent Visitor

Hi again, 

 

I was able to make it work 🙂

first I tried to use UNION function with the combination of ROW function, but it did not work since ROW function returns only 1 calculated row.

 

NewTable = UNION(Sheet1,
SELECTCOLUMNS(Sheet1,"Date",CALCULATE(max(Sheet1[Date]),FILTER(Sheet1,Sheet1[Losses]>0&&Sheet1[No]=EARLIER(Sheet1[No]))),
"Project Type",IF(Sheet1[Losses]>0,"loss",Sheet1[Project Type]),"Hours",Sheet1[Hours],"Billabulity",IF(Sheet1[Losses]>0,"Non Billable",Sheet1[Billability]),"Losses",CALCULATE(Max(Sheet1[losses]),FILTER(Sheet1,Sheet1[Losses]>0&&Sheet1[No]=EARLIER(Sheet1[No]))),"hours after correction",IF(Sheet1[Losses]>0&&Sheet1[Project Type]="Fix Price",Sheet1[Losses],IF(Sheet1[Billability]="Non Billable",0,Sheet1[hours after correction])),"No",Sheet1[No]))

 

Using SELECTCOLUMNS function instead gave me the possibility to have multiple calculated rows, I attach the pbi file here.

 

Thanks, 

Abdel. 

View solution in original post

1 REPLY 1
Abdel_BCN
Frequent Visitor

Hi again, 

 

I was able to make it work 🙂

first I tried to use UNION function with the combination of ROW function, but it did not work since ROW function returns only 1 calculated row.

 

NewTable = UNION(Sheet1,
SELECTCOLUMNS(Sheet1,"Date",CALCULATE(max(Sheet1[Date]),FILTER(Sheet1,Sheet1[Losses]>0&&Sheet1[No]=EARLIER(Sheet1[No]))),
"Project Type",IF(Sheet1[Losses]>0,"loss",Sheet1[Project Type]),"Hours",Sheet1[Hours],"Billabulity",IF(Sheet1[Losses]>0,"Non Billable",Sheet1[Billability]),"Losses",CALCULATE(Max(Sheet1[losses]),FILTER(Sheet1,Sheet1[Losses]>0&&Sheet1[No]=EARLIER(Sheet1[No]))),"hours after correction",IF(Sheet1[Losses]>0&&Sheet1[Project Type]="Fix Price",Sheet1[Losses],IF(Sheet1[Billability]="Non Billable",0,Sheet1[hours after correction])),"No",Sheet1[No]))

 

Using SELECTCOLUMNS function instead gave me the possibility to have multiple calculated rows, I attach the pbi file here.

 

Thanks, 

Abdel. 

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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