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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dommyw277
Helper III
Helper III

Report Help -

Hi

Im trying to Create a report that lists by month, top 10 categories month by month, some will change each months so in need to reflect this , is this possible?monthsexamplepowerbi.JPG

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

Hi  @dommyw277 ,

I created some data:

vyangliumsft_0-1653482796405.png

Here are the steps you can follow:

1. Create measure.

Count =
var _select=SELECTEDVALUE('Table'[Month])
return
COUNTX(FILTER(ALL('Table'),'Table'[Month]=_select&&'Table'[Group]=MAX('Table'[Group])),[Group])
rank =
RANKX(ALL('Table'),[Count],,DESC,Dense)
Flag =
IF(
    [rank]<=10,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1653482796405.png

3. Result:

vyangliumsft_2-1653482796409.png

 

For errors, you can refer to:

https://community.powerbi.com/t5/Desktop/Column-cannot-be-found-or-may-not-be-used-in-this-expressio...

If I have misunderstood your meaning, please provide your desired output and your pbix without privacy information.

 

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

11 REPLIES 11
v-yangliu-msft
Community Support
Community Support

Hi  @dommyw277 ,

I created some data:

vyangliumsft_0-1653482796405.png

Here are the steps you can follow:

1. Create measure.

Count =
var _select=SELECTEDVALUE('Table'[Month])
return
COUNTX(FILTER(ALL('Table'),'Table'[Month]=_select&&'Table'[Group]=MAX('Table'[Group])),[Group])
rank =
RANKX(ALL('Table'),[Count],,DESC,Dense)
Flag =
IF(
    [rank]<=10,1,0)

2. Place [Flag]in Filters, set is=1, apply filter.

vyangliumsft_1-1653482796405.png

3. Result:

vyangliumsft_2-1653482796409.png

 

For errors, you can refer to:

https://community.powerbi.com/t5/Desktop/Column-cannot-be-found-or-may-not-be-used-in-this-expressio...

If I have misunderstood your meaning, please provide your desired output and your pbix without privacy information.

 

If you need pbix, please click here.

 

Best Regards,

Liu Yang

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

Thank you so much! Works a treat

dommyw277
Helper III
Helper III

So using the table I have called ReportData , the fields are Category and Month , I have this - can anyone help where im going wrong please?

 

calculate(Sum(ReportData[Category]) ,TOPN(10,all(ReportData[Category]),calculate(Sum(ReportData[Month]) )), values(ReportData[Category]))

Hi,

This measure is correct.  What problem are you facing?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

The issue appears to be that im trying to SUM Text fields so maybe thats why the TOP n argument isnt working?

 

calculate(Sum(ReportData[Category]) ,TOPN(10,all(ReportData[Category]),calculate(Sum(ReportData[Month]) )), values(ReportData[Category]))

 

Hi,

Does this work?

=calculate(countrows(ReportData) ,TOPN(10,all(ReportData[Category]),calculate(Sum(ReportData[Month]) )), values(ReportData[Category]))


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi, so ReportData is replaced by NewCherwell however i get these messages. Maybe because Month is a part of created date time?

 

reporterror2230522.JPGreporterror1230522.JPG

Hi,

I cannot help without having access to your file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi im getting this message:

ReportData is replaced by CherwellNEW for info

 

reporterror230522.JPG

reporterror2230522.JPG

dommyw277
Helper III
Helper III

bireporthelpsnip.JPGHi, what do i put where the value is?  

amitchandak
Super User
Super User

@dommyw277 , Create a TOPN measure and display is with month and category

 

calculate(Sum(Table[Value]) ,TOPN(1,all(Table[category]),calculate(Sum(Table[Value]) )), values(Table[category]))

 

or refer this

 

https://www.sqlbi.com/articles/filtering-the-top-3-products-for-each-category-in-power-bi/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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 MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.