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
niteshtrehan89
Helper III
Helper III

TOPN/ others with Tableau LOD to Power BI

Hi Techies,

 

Happy New Year.

 

I am stucked into an urgent requirement which requires migration of a tableau asset to Power BI. In Tableau, I have a measure as

LOD Sales= {fixed (employee name): avg(sales)}

I want to convert this measure into Power BI. 

Secondly, I need to plot a bar chart between the Product category and LOD Sales on the basis of dynamic TOP N / Others.

1 ACCEPTED SOLUTION

Hi @niteshtrehan89 

I have a test by the sample I show you before.

1.png

Build a TopN table to build a slicer.

TopN = GENERATESERIES(1,DISTINCTCOUNT('Table'[Employee Name]))

Measure:

Transform Tableau :LOD Sales= {fixed (employee name): avg(sales)}

into measure Avg.

Avg = CALCULATE(AVERAGE('Table'[Sales]),ALLEXCEPT('Table','Table'[Employee Name]))
Measure = 
VAR _TopN = IF(ISFILTERED('TopN'[Value]),SELECTEDVALUE('TopN'[Value]),MAX('TopN'[Value]))
Var _T1 = TOPN(_TopN,SUMMARIZE(ALL('Table'),'Table'[Employee Name],"Avg",[Avg]),[Avg],DESC)
Return
SUMX(FILTER(_T1,[Employee Name]=MAX('Table'[Employee Name])),[Avg])

Result is as below.

By default it will show all values.

3.png

If you select Top1, it will only show A in visual.

4.png

Best Regards,

Rico Zhou

 

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

8 REPLIES 8
v-rzhou-msft
Community Support
Community Support

Hi @niteshtrehan89 

Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file from your Onedrive for Business.

 

Best Regards,

Rico Zhou

v-rzhou-msft
Community Support
Community Support

Hi @niteshtrehan89 

Due to I don't know your data model, I build a sample to have a test.

1.png

Measure:

 

Measure = 
CALCULATE(AVERAGE('Table'[Sales]),ALLEXCEPT('Table','Table'[Employee Name]))

For more details convert tableau to measure, you may refer to this blog: Tableau to Power BI: FIXED LOD Expressions

 

Result is as below.

2.png

If you want to use TopN, you can use TopN function in your visual as below.

3.png

Best Regards,

Rico Zhou

 

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

 

 

Hi Rico, 

 

I need to create the TOP N and Other Analysis dynamically. 

Hi @niteshtrehan89 

What does dynamic mean? Do you want to show your result dynamically by slicer?

Measure is a good way to show dynamic result.

Please share a sample to me by your Onedrive for Business.

Could you show a screenshot of the result you want?

This may make it easier for me to understand your requirement.

 

Best Regards,

Rico Zhou

 

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

 

On the basis of slicer select i need the top n and others values 

Hi @niteshtrehan89 

I have a test by the sample I show you before.

1.png

Build a TopN table to build a slicer.

TopN = GENERATESERIES(1,DISTINCTCOUNT('Table'[Employee Name]))

Measure:

Transform Tableau :LOD Sales= {fixed (employee name): avg(sales)}

into measure Avg.

Avg = CALCULATE(AVERAGE('Table'[Sales]),ALLEXCEPT('Table','Table'[Employee Name]))
Measure = 
VAR _TopN = IF(ISFILTERED('TopN'[Value]),SELECTEDVALUE('TopN'[Value]),MAX('TopN'[Value]))
Var _T1 = TOPN(_TopN,SUMMARIZE(ALL('Table'),'Table'[Employee Name],"Avg",[Avg]),[Avg],DESC)
Return
SUMX(FILTER(_T1,[Employee Name]=MAX('Table'[Employee Name])),[Avg])

Result is as below.

By default it will show all values.

3.png

If you select Top1, it will only show A in visual.

4.png

Best Regards,

Rico Zhou

 

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

 

 

amitchandak
Super User
Super User

@niteshtrehan89 , Try measures  like

Avg Sales= AverageX(values(Table[employee]), calculate(Sum(Table[Sales])))


Top 10 Rank = CALCULATE([Avg Sales],TOPN(10,all(Table[Product category]),[Avg Sales],DESC),VALUES(Table[Product category]))

 

TOPN with others : https://blog.gbrueckl.at/2019/05/power-bi-dynamic-topn-others-with-drill-down/

https://blog.gbrueckl.at/2019/05/power-bi-dynamic-topn-others-with-drill-down/

Hi Amit, 

Top N function is not working fine and is not matching with the values.

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.