cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Helper II

## Help me understand these measures

Okay so I shamelessly copy and pasted a DAX formula into my project and it worked. But I also want to understand how it works so please help a guy out!

Basically the measures are for a Top N slicer slider. So first, I have this measure and note that TopN table just consists of the numbers from 2 to 20 (increment by 2)

And then I have this measure next for what I assume to be the ranking obviously but I dont understand how it works

Lastly is this measure and this is the measure that I will put as a visual level filter and set it to CategoryInclude is 1 in the filter pane

I have a vague idea of how it all works but the HASONEVALUE is the thing that's making me confused and I would greatly appreciate if someone can help me understand all these!

Thank you!

1 ACCEPTED SOLUTION
Super User

Hi @RingoSun ,

Looking at the code basically you have the following setup:

@RingoSun wrote:

In this metric you are checking if there is one value selected on the TOPN table, if you have more than one value selected this metric returns false, so when you have one value of the topN you return that value, if you have more than one you return 10.

@RingoSun wrote:

On this second measure you do the same thing so check if there is a single category select and if that is true you return the ranking of sales  based on the category

@RingoSun wrote:

On this last measure you check if the Categoryrank is lower or equal to the TOPN number, so basically if the Ranking is lower or equal than your TOPN you get a value of 1 otherwise you get a value of 0 when you filter based on the 1 your visualization only presents the values that are lower than the SelectedTopNumber

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português

Super User

Hi @RingoSun ,

Looking at the code basically you have the following setup:

@RingoSun wrote:

In this metric you are checking if there is one value selected on the TOPN table, if you have more than one value selected this metric returns false, so when you have one value of the topN you return that value, if you have more than one you return 10.

@RingoSun wrote:

On this second measure you do the same thing so check if there is a single category select and if that is true you return the ranking of sales  based on the category

@RingoSun wrote:

On this last measure you check if the Categoryrank is lower or equal to the TOPN number, so basically if the Ranking is lower or equal than your TOPN you get a value of 1 otherwise you get a value of 0 when you filter based on the 1 your visualization only presents the values that are lower than the SelectedTopNumber

Regards

Miguel Félix

Proud to be a Super User!

Check out my blog: Power BI em Português