- Forums
- Get Help with Power BI
- Desktop
- Service
- Report Server
- Integrations with Files and Services
- Mobile Apps
- Developer
- Let's Talk Data
- Custom Visuals Development Discussion
- Community Support
- Welcome to the Community
- Community Feedback
- Community Help Blog
- Training and Consulting
- Dashboard in a Day
- EdX Specific Training Discussion Forum

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Microsoft Power BI Community
- Forums
- Get Help with Power BI
- Desktop
- Re: Difference filter instead of calculating diffe...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Zach_TCF

Frequent Visitor

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-13-2018
11:05 AM

I recognize the value of the calculate formula, but am wondering if there's an optimal way to calculate the difference based on specific filtering critera for a data column and then dynamically display this 'filtering difference' methodolology for many other data columns.

As an example, each of my data columns includes rows of data with 'Current Forecast' and 'Prior Forecast' detail. I would like to have predefined 'Current Forecast vs. Prior Forecast' and 'Current Forecast vs. Plan' measures that can calculate this difference based on the data column(s) that I choose to display (such as Ratio 1) in my Power BI visuals. I would never need to calculate differences horizontally from 2 data columns (such as ratio 1 vs ratio 2). Below is a sample screenshot of the data structure that envision.

Based on my understanding and use of the the calculate formula, the basic formula locks you into a data column the you specify, and therefore I would need to create 6 different calculate measures just to display Current Forecast vs Prior Forecast for the 3 Ratios and 3 Stat data columns.

Solved! Go to Solution.

Report Inappropriate Content

Message 1 of 7

1 ACCEPTED SOLUTION

Accepted Solutions

v-jiascu-msft

Community Support Team

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-20-2018
06:46 PM

Hi Zach,

I found a new solution without changing your data structure. Please download the demo in the attachment.

1. Create a new table.

Items No. Widget Margin 1 Widget Waste 2 Survey Satisfaction 3 Widgets Produced 4 Meetings 5 Calls 6

2. Create two measures.

Current Forecast vs. Prior Forecast New = SWITCH ( SELECTEDVALUE ( 'Table3'[No.] ), 1, CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Prior Forecast" ), 2, CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Prior Forecast" ), 3, CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Prior Forecast" ), 4, CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Prior Forecast" ), 5, CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Prior Forecast" ), 6, CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Prior Forecast" ), 99999 )

Forecast vs. Plan New = SWITCH ( SELECTEDVALUE ( 'Table3'[No.] ), 1, CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Plan" ), 2, CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Plan" ), 3, CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Plan" ), 4, CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Plan" ), 5, CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Plan" ), 6, CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Plan" ), 99999 )

3. Now you can format the old table as you wish.

Best Regards,

Dale

Community Support Team _ Dale

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

If this post

6 REPLIES 6

Zach_TCF

Frequent Visitor

Dynamic Variance Calculations across factual data columns

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-13-2018
02:33 PM

I have approximately 50 columns of unique factual data and am wondering if there's a way to create variance calculations that can be used across each of these columns. The variance calculations would be created based off of the dimensional attributes such as Current Forecast versus Prior Forecast, or Business A vs Businss.

Highlighted
##

v-jiascu-msft

Community Support Team

Re: Difference filter instead of calculating differences

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-14-2018
06:51 PM

Hi @Zach_TCF,

Can you share a sample of the ORIGINAL data, please?

1. What are the 3 Ratios and 3 Stat? Are they columns or measures?

2. What's the expected result?

Best Regards,

Dale

Community Support Team _ Dale

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

If this post

Zach_TCF

Frequent Visitor

Re: Difference filter instead of calculating differences

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-19-2018
11:58 AM

Hi @v-jiascu-msft,

Thanks for your questions. I'm not able to share the original data, but below is fake data to better visualize the question. As you can see, the 6 data columns (3 ratios and 3 stat) are each unique. My Goal is to have 1 calculation 'Current Forecast vs. Prior Forecast' that I can use across all 6 columns, while being able to filter on the month or business (Bus. A or Bus. B). I would like a second calculation to display Current Forecast vs. Plan.

v-jiascu-msft

Community Support Team

Re: Difference filter instead of calculating differences

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-19-2018
11:34 PM

Hi @Zach_TCF,

I would suggest you transform the data structure that makes the calculation easily. Please download the demo in the attachment.

Current Forecast vs. Prior Forecast = SUM ( Table1[Current Forecast] ) - SUM ( Table1[Prior Forecast] )

Forecast vs. Plan = sum(Table1[Current Forecast]) - sum(Table1[Plan])

Best Regards,

Dale

Community Support Team _ Dale

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

If this post

Zach_TCF

Frequent Visitor

Re: Difference filter instead of calculating differences

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-20-2018
06:54 AM

Hi @v-jiascu-msft,

Thank you for your feedback. As one follow-up to your solution, do you have any recommendations if I wanted to display 'Widget Margin' and 'Widget Waste' as a percent? It's my understanding that the data for these attributes would have to be reflected in separate data columns if I wanted to display them as at a % instead of the decimals that you've defined for these 3 data columns. My goal is to limit the number of variance columns that are created, but have the flexibility to display certain attributes as different data types (such as %'s).

Thanks,

Zach

v-jiascu-msft

Community Support Team

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-20-2018
06:46 PM

Hi Zach,

I found a new solution without changing your data structure. Please download the demo in the attachment.

1. Create a new table.

Items No. Widget Margin 1 Widget Waste 2 Survey Satisfaction 3 Widgets Produced 4 Meetings 5 Calls 6

2. Create two measures.

Current Forecast vs. Prior Forecast New = SWITCH ( SELECTEDVALUE ( 'Table3'[No.] ), 1, CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Prior Forecast" ), 2, CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Prior Forecast" ), 3, CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Prior Forecast" ), 4, CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Prior Forecast" ), 5, CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Prior Forecast" ), 6, CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Prior Forecast" ), 99999 )

Forecast vs. Plan New = SWITCH ( SELECTEDVALUE ( 'Table3'[No.] ), 1, CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Margin] ), Table2[Scenario] = "Plan" ), 2, CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widget Waste] ), Table2[Scenario] = "Plan" ), 3, CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Survey Satisfaction] ), Table2[Scenario] = "Plan" ), 4, CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Widgets Produced] ), Table2[Scenario] = "Plan" ), 5, CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Meetings] ), Table2[Scenario] = "Plan" ), 6, CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Current Forecast" ) - CALCULATE ( SUM ( Table2[Calls] ), Table2[Scenario] = "Plan" ), 99999 )

3. Now you can format the old table as you wish.

Best Regards,

Dale

If this post