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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
daniel_baciu
Helper I
Helper I

Filtering a table using measures based on slicers

Hi,

 

This is a very easy question for the experienced users.

I have a table:

2023-07-14 18_00_39-Changes in scenarios - Power BI Desktop.png

I want to show a visual (table/matrix) showing only the changes by project from a scenario to another. For example - result of changes in JUL scenario vs APR scenario should look like below, as there is only one change in project A between the 2 scenarios in the same period:

2023-07-14 18_02_29-Changes in scenarios - Power BI Desktop.png

Currently, this is managed to be calculated using 2 manual measures where i filtered APR (see below) and JUL separately

 

APR = 
CALCULATE(
    SUM(Data[Value]),
    Filter(
        'data',
        'data'[Scenario] = "APR Scenario"
    )
)

 

 

and another measure ("Changes") where i deducted APR measure result from JUL measure:

 

 

Changes = [JUL] - [APR]

 

 

Question is - how can i automatically calculate the Changes by asking the user to select in a slicer the first scenario and the second scenario (like below)? 

 

2023-07-14 18_07_24-Changes in scenarios - Power BI Desktop.png

User should select in the first one JUL and in the second one APR, and the result should appear in a table/matrix visual like below:

2023-07-14 18_02_29-Changes in scenarios - Power BI Desktop.png

 

See here the pbix.

Thanks!

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @daniel_baciu 

 

You can try the following methods.

Change = IF(HASONEVALUE(Data[Scenario]),SUM(Data[Value]),CALCULATE(MAX(Data[Value])-MIN(Data[Value]),ALLSELECTED(Data[Scenario])))

vzhangti_0-1689838865808.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

 

Many Thanks!
This works fine but, i didn't realize before one additional complexity. Your solutions works fine when there are the same number & name of projects in every scenario (project A, B, C appear in every scenario). 

 

Unfortunately your solution doesn't work when projects disapear or new projects appear in future scenarios... I reattached your solution and have updated OCT Scenario (removed project C and added Project D). 

 

Solution of the Change should be as follows:

Project    Change

A             100

B              0

C              -50

D              60

 

May i kindly ask you to have another look to see if you can provide an updated solution to this specific issue?

Many thanks!

 

File is here.

Idrissshatila
Super User
Super User

Hello @daniel_baciu ,

 

Try using field parameters, check it out here https://learn.microsoft.com/en-us/power-bi/create-reports/power-bi-field-parameters

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

Follow me on Linkedin



Did I answer your question? Mark my post as a solution! Appreciate your Kudos
Follow me on LinkedIn linkedIn
Vote for my Community Mobile App Idea

Proud to be a Super User!




Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

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

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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