Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
RingoSun
Helper II
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)

RingoSun_0-1658145913993.png

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

RingoSun_2-1658146020398.png

 

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

RingoSun_3-1658146082924.png

 

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
MFelix
Super User
Super User

Hi @RingoSun ,

 

Looking at the code basically you have the following setup:


@RingoSun wrote:

 

RingoSun_0-1658145913993.png


 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:

RingoSun_2-1658146020398.png


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:

 

RingoSun_3-1658146082924.png


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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



View solution in original post

1 REPLY 1
MFelix
Super User
Super User

Hi @RingoSun ,

 

Looking at the code basically you have the following setup:


@RingoSun wrote:

 

RingoSun_0-1658145913993.png


 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:

RingoSun_2-1658146020398.png


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:

 

RingoSun_3-1658146082924.png


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


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.