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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to use (Ntile for SQL server) or Percentiles of DAX properly when used on selected filters?

Hi all,

 

I have below data for 6-weeks for 6-users with 4-specailty here

 

skondi_0-1607437686428.png

 

Expected Output:

when selected one of the specialty, the Ntile should work properly ..say n = 4.

 

skondi_0-1607582943804.png

 

 

 

I am trying to extract users on basis of selected specailty and provide a ntile score.

I have went through this answer     but that I couldnt understand how it works.

In SQL server, I am able to do it correctly using NTILE function with partition by specailty.

Please someone explain me the logic in DAX(mostly needed a measure as I have around 0.5M userIDs with around 4M of rows)

 

Thanks in Advance!!

 

 

 

 

1 ACCEPTED SOLUTION
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your link to this function in SQL Server, I guess this is a function which can dynamically group the data of a column in order, I could not find the related function in DAX library, but I guess the group and bin in Power BI can achieve this properly, you can take a look:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-grouping-and-binning

You can also go to the DAX library to find if there is a function like Ntile() for SQL server:

https://docs.microsoft.com/en-us/dax/dax-function-reference

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your link to this function in SQL Server, I guess this is a function which can dynamically group the data of a column in order, I could not find the related function in DAX library, but I guess the group and bin in Power BI can achieve this properly, you can take a look:

https://docs.microsoft.com/en-us/power-bi/create-reports/desktop-grouping-and-binning

You can also go to the DAX library to find if there is a function like Ntile() for SQL server:

https://docs.microsoft.com/en-us/dax/dax-function-reference

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-robertq-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description and expected output, I think you want to get a measure which displays the rank of [S-Score] group by [specailty], you can try this measure:

 

Expecting =

RANKX(

    FILTER(

        ALLSELECTED('Table'),

    [Specialty]=MAX([Specialty])),

    CALCULATE(MAX('Table'[S-Score])),,

    DESC,

Dense )

 

Then create a table chart and place columns and measure like this:

v-robertq-msft_0-1607498761247.png

 

And you can get what you want.

You can download my test pbix file here

 

Best Regards,

Community Support Team _Robert Qin

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello, where is the link of your test board? Thank you

Anonymous
Not applicable

Hi buddy, thanks for replying to my question. Actaully Its not about rank..I am looking for equivalent of  sql server Ntile()  function in powerBI.  I have update my screenshot.. can you please help me !!

Hello I hope you are well, you found a solution?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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