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

Applying a formula to a subset of rows within a table

Hello! 

 

I was wondering if there was a way to apply a function to only a subset of rows within a table? I would ideally like to create a report in which the user is able to select what years a specific percent reduction (greenhouse gas in this case) is starting and ending. The selection of the starting and ending date can easily be performed through the use of a parameter but I have not found a way to select  the rows of interest after this parameter was selected without applying this percent reduction rate to all of the rows within this column. 

 

Any tips or comments witll be helpful. Thanks! 

Austin I 

1 ACCEPTED SOLUTION

@Anonymous ,

 

Firstly, click on column [S1], [S2] and [S3] then click "Unpivot" like below:

1.PNG 

 

Then create three calculate columns and then drag them to table visual like below:

Start Date = CALCULATE(MIN('Table'[Year]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))
End Date = CALCULATE(MAX('Table'[Year]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))
Reduction = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))

2.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

I have also created an example excel file showing exactly what I would like to do in PowerBI if that may help understand my request I am happy to share! 

 

 

@Anonymous ,

 

Could you share some sample data and give the expected result?

 

Regards,

Jimmy Tao

Anonymous
Not applicable

No problem, here is a link to the box file with only 3 of the "strategies" inputted. 

 

You can see the bottom rows are the "inputs" and ultimately effect the totals in different years which is displayed in the visual to the right. 

 

Excel File

 

Thanks, 

Austin I 

@Anonymous ,

 

Firstly, click on column [S1], [S2] and [S3] then click "Unpivot" like below:

1.PNG 

 

Then create three calculate columns and then drag them to table visual like below:

Start Date = CALCULATE(MIN('Table'[Year]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))
End Date = CALCULATE(MAX('Table'[Year]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))
Reduction = CALCULATE(MAX('Table'[Value]), FILTER(ALLEXCEPT('Table', 'Table'[Season]), 'Table'[Value] <> 0))

2.PNG 

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.