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!" )