PowerPivotPro

PowerPivotPro is Coming to Atlanta

March 20 - 22, 2018

Registration for 2018 Public Training is now open!

AVAILABLE CLASSES

**Use the discount code “3ORMORE” when signing up 3 or more people.

MARCH 20 - 21

Foundations: Power Pivot & Power BI

Instructor: Austin Senseman

Super charge your analytics and reporting skills with Microsoft’s dynamic duo. Designed to handle huge volumes of data, these tools will transform the way you work! Two Days in our class and you are EMPOWERED!

  • Learn Microsoft’s secret weapon behind Power Pivot & Power BI: DAX
  • Taught by Austin Senseman – PowerPivotPro Partner
  • You don’t need to be an IT professional – most of our students come from an Excel background
Atlanta Public Training Classes
Atlanta Public Training Classes

MARCH 20 - 21

Level Up Series: Advanced DAX

Instructor: Ryan Sullivan

The Advanced DAX Course was such a hit in the first half of 2017 that we’ve expanded the course to 2 days!

Overview

  • This advanced DAX training class is taught completely in Power BI Desktop
  • Students are encouraged to take our Foundations course and have hands on experience with the DAX language
  • Taught by Ryan Sullivan – Principal Consultant
  • Class material drawn from usage of Advanced DAX applications while consulting with hundreds of international firms

MARCH 22

Level Up Series: Power Query for Excel & Power BI

Instructor: Ryan Bergstrom

The second class in the series is our Level Up Series is Power Query for Excel & Power BI.

  • Students are encouraged to take our Foundations course and have hands on experience with Power Query in Excel or Power BI Desktop
  • Taught by Ryan Bergstrom – Principal Consultant and Trainer
  • We will cover common to unique business challenges made easy with Power Query’s data wrangling capabilities
  • Intermediate to Advanced Level Power Query best practices distilled into easy to understand patterns to apply to your most common business challenges
Atlanta Public Training Classes
PowerPivotPro Logo

Data Ambiguity…The Silent Report Killer

Hello P3 Nation, I’m excited to be back and writing a technical post again…it’s been too LONG! Today I want to talk to you about a real-world business problem and solution I encountered last year. I think it’s a scenario at least a few of you will relate to. I was working on a project for a client, and needed to create a Power BI report for them.

However, the client didn’t think the active filters in the report were easy to identify. Now this is a scenario I’ve encountered a few times over the years, whether it’s been in Power BI, Excel, or other reporting tools. Overall it comes down to this, data ambiguity can render a report A) Untrustworthy, B) Dangerous, or C) Useless. Personally, I think a well-designed Power BI report has clear “enough” call-outs on the filters. Truth be told though, it only partially matters what we think. At the end of the day, we need to cater the report to the client’s needs.

Please click here to download the workbook to follow along.

Typical report layout I create. Primary sections for – Headers, Slicers, Visuals/Tables:

Power_BI_Report_Before_Filter_Cards

“I Can See (Filters) Clearly Now”

The client and I brainstormed, and we decided to create card visuals to identify filter selections. The beautiful thing about DAX, as mentioned in many articles on our site, is that it can easily return text values. I actually did something similar to this with Dynamic Titles when I posted about Power BI’s new Drill Through feature last year, that article can be found here. So, I essentially wanted to do something similar here, but to call out the filter selection for each slicer. The end result looked something like this

Same report with additional section for slicer filter selection:

Power_BI_Report_After_Filter_Cards

The end result was a new section of the report, dedicated to calling out slicer selections. The BIGGEST reason the client wanted this, was for screenshots. They often took screenshots of this report, and pasted it into emails or slides to use in presentations. The result works well, and uses a bit of clever DAX to always return the right selections, no matter the combination of selections among the slicers.

DAX (SELECTEDVALUES) To The Rescue!

To get the right output with DAX I utilized one of the newer functions, Selected Values. Selected Values is used whenever you use the What If feature in Power BI Desktop. In fact…if you look at my screenshots above, the Rolling Avg Months & Expense Ratio What Ifs are attached to Selected Values measures. Selected Values works like this, you give it a column reference, let’s say [Column A]. If there’s a selected value (E.g. single selection) on that column, it returns that value. Otherwise there’s an alternative result returned. Here’s what the DAX Measure looks like for the Expense Ratio Value.

     Expense Ratio Value = SELECTEDVALUE(‘Expense Ratio'[Expense Ratio], 0.50)

Selected Values is a fairly simple, and straight forward function. For a thorough and in-depth article on it’s uses and abilities, I’ll refer you to a post Marco Russo wrote over at SQLBI. I figured I could use this function to point to my slicer columns, and return a “No Selection” alternative result if there wasn’t. I thought that’s all I’d need, just rinse and repeat a bunch of Selected Values measures, and I’d be done! Not quite…I noticed a few issues after I did this.

Filter Issue Number One

I quickly realized that I was getting false positive filter selections when using certain slicers. As an example, whenever I made a specific selection on Employee Sales Region, sometimes the filter selection for Employee Team Name would change too! What was happening is there was a Sales Region with only a SINGLE Team name. It was triggering the Selected Value logic, because only a SINGLE VALUE was being given to it.

False positive filter selection, despite no selection on the slicer:

Power_BI_ISFILTERED_Problem

I needed my DAX measure to run ONLY when there’s an ACTIVE filter on the column. Selected Values doesn’t check to see if the column has an active filter on it, instead it’s only checking to see if there’s a single value from that column. Some additional business logic would need to be applied to it, to FIRST check for active filtering BEFORE running the Selected Values logic. I worked through a few variations, and eventually ended up using the DAX Function ISFILTERED.

     Employee Sales Region Selection = IF( ISFILTERED(‘Employee Details'[Employee Team Name]), SELECTEDVALUE(‘Employee Details'[Employee Team Name], “No Selection”), “No Selection”)

Filter Issue Number Two

ISFILTERED worked, and I no longer got a false positive filter selection! However, further testing unveiled a second problem. The other issue aired its ugly head whenever a slicer had multiple selections on it. Now my DAX is returning a false negative! I want it to return “Multiple Selections” if I have TWO or more slicer selections. This will be an easy enough fix actually.

The Employee Sales Region Selection DAX (above) has two conditions it’s checking. Condition one (ISFILTERED) is checking if there’s an ACTIVE filter on the column. If that condition is met, then it checks condition two (SELECTEDVALUES), which checks to see if there’s only ONE value coming from that column. If that second condition isn’t met, it returns “No Selection” at the inner most part of the query. All we have to do is update the alternative result in condition two, and change it to “Multiple Selections“.

     Employee Sales Region Selection = IF( ISFILTERED(‘Employee Details'[Sales Region]), SELECTEDVALUE(‘Employee Details'[Sales Region], “Multiple Selections”), “No Selection”)

BEFORE – Multiple selections on the slicer, but no indication of filters on the card:

Power_BI_Multiple_Selection_Problem

AFTER – Multiple selections on the slicer, Multiple Selections indicator on card:

Power_BI_Multiple_Selection_Solution

It’s also possible to return the entire list of selected values, instead of “Multiple Selections”. In fact, Rob has a great post on how to do JUST THAT. It utilizes a DAX Function called CONCATENATEX, and I’d recommend giving it a read. I didn’t go that route, as the client was happy just having multiple selections as the output for this scenario. There you have it folks, a great way to add a bit of clarity to your report. In case youever need a really obvious call-out for your slicer selections. I’m glad to be back in the technical saddle a bit on post writing, look forward to some more posts from me this spring!

  Subscribe to PowerPivotPro!
X

Subscribe

Reid Havens

Reid Havens is a Principal Consultant for PowerPivotPro. His passion is collaborating with individuals and organizations to help them understand their business. Using his formal backgrounds in technology and organizational management Reid has worked with various local and multi-national companies. He is also an adjunct professor at Bellevue College, guest lectures at the University of Washington, and provides corporate trainings centered around Business Intelligence, Reporting, & Design. 

This Post Has 18 Comments

  1. Excellent article – I use the ‘Selected Value to provide dynamic titles for reports. Is it possible to configure the Filter Selection Cards so that the ‘Filter Title’ precedes the ‘filtered value’ – believe that this is more user friendly and quicker way of reading the Filter Selection Cards.

    1. So, just curious why you would use “No Selection” as opposed to “All ….” as your alternate such that the value under Employee Sales Region would read “All Sales Regions”, Employee Team Name, “All Teams”. That is more specific to the information being displayed.

      1. Customer request was to have the display be no selection. It’s really a matter of preference. But yes, All would more closely match the All displayed in the slicer.

    2. You could certainly easily do that using a concatenate function in the DAX. The biggest reason was all that text wouldn’t have easily fit on a single line using the multi card visual.

  2. Hi Reid,

    I’m trying to understand the logic behind your post and am a little confused regarding the Filter Issue Number One. You show the following DAX measure:

    Employee Sales Region Selection = IF( ISFILTERED(‘Employee Details'[Sales Region]), SELECTEDVALUE(‘Employee Details'[Sales Region], “No Selection”), “No Selection”)

    The only column referenced here is ‘Employee Details'[Sales Region]’ shouldn’t that be something like ”Employee Details'[Sales Team]’ and the name be ‘ Employee Sales Team Selection ‘ instead or am I missing something here? I mean SELECTEDVALUE(‘Employee Details'[Sales Region] … can’t possibly reflect the selection of values on the sales team slicer.

    Best regards Jes

    1. Ah good catch! The logic remains the same, however you’re right. It should be the team name column. I updated to have it reflect that.

  3. Great post – thanks Reid.

    Just to confirm.. SELECTEDVALUE can only refer to Page level filters and not Report level filters? I believe the PBI development team is working on the option for Slicers to be applied (connected) to multiple reports as in Excel.

    1. Hi James, that’s “currently” correct. However we’re about to do a post VERY SOON about the universal slicer feature that is about to be released. Making this post even more relevant!

      1. Hi Reid, thanks. As luck would have it Microsoft announced the completion of the universal slicer feature yesterday. I look forward to your associated post.

  4. Hi Reid, Thank you very much. Great Article. Only one thing I can’t figure out is how you were able to get the selections to display horizontally in the multi-row card visual. I have both Card Title and Card in my format section of the visual where you have just Card. Any thoughts?

  5. Thanks for this interesting and helpful post! I like the Visual of the “Total Orders by Year, Quarter and Employee name”. What’s the name of this Visual in Power BI ? Where can I download this visual ? I searched in the Microsoft Power BI visual marketplace but didn’t find it 🙁

Leave a Comment or Question