Menu
Stuff by Yuki
  • Home
  • Data Engineering
    • Python
  • Business Intelligence
    • Power BI
    • Tableau
  • Perspectives
  • About
  • Contact
Stuff by Yuki

Detecting If Value Is Filtered in Power BI

Posted on June 2, 2021July 28, 2021

WoW 2021 Week18 – Power BI

In this exercise, I implemented ISFILTERED() function in DAX. I was to create a simple game where the user selects pictures of either a cat or croissant, and they are to select only cats to win the game.

I didn’t have a solution at first, but I eventually came up with a solution; use a slicer visual.

My solution includes detecting if the image column is filtered or not, which involves ISFILTERED() function. I needed to create the whole logic with some numerical values as well.

DAX makes it possible to implement what seems impossible at first!

The following DAX code is the only thing I needed to create for this game to work:

Status = 
var score = SUM( catorcroissantdata[iscat] )
var minValue = MIN( catorcroissantdata[iscat] )
var maxValue = MAX( catorcroissantdata[iscat] )

RETURN 

SWITCH( TRUE(),
    score = 4, "You Win!",
    minValue = -1 && ISFILTERED( catorcroissantdata[image] ), "You Lose...",
    //else
    "Keep Going!"
)

Data Source | Source Code

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Where I’m Headed in the Next 5 Years
  • Open-Source vs Vendor Data Tools
  • Developing the Habit of Writing
  • How to Inspect and Optimize Query Plans in Python Polars
  • Learn Python Polars with Polars Cookbook

Popular Posts

  • A Running Total Calculation with Quick Measure in Power BI
  • A Complete Guide to Git Integration in Power BI
  • How To Copy And Paste Report Page in Power BI
  • Handling Missing Values in Polars
  • How to Convert String to Date or Datetime in Polars

connect with me

  • LinkedIn
  • Twitter
  • Github
  • Website

Search Articles

©2025 Stuff by Yuki | Powered by SuperbThemes