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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Help with combining firstnoblank and allexcept

Hi all,

 

I have some trouble combining ALLEXCEPT with firstnoblank and summarize. My statement looks like this now: 
 

var max1_y = FIRSTNONBLANK(
    SUMMARIZE(TOPN(1,
        SUMMARIZE(data, data[year], "sales amount", SUM(data[sales])),
        [sales amount], 0
        ), data[year]),1)
 
However, I would like to include ALLEXCEPT to the statement which I do not manage.
Is that possible? Or can I rewrite in another way to achieve the same thing? (I want to get the year with the greatest sales, and then the same for the year with the loweest sales).
Can anyone help me with this? 

Any help is greatly appreciated!
2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , I think new index function can do a better job

Power BI Index function: Top/Bottom Performer by name and value- https://youtu.be/HPhzzCwe10U

 

like

Maxx(index(1,addcolums(allselected( data[year]), , "sales amount", SUM(data[sales]), orderby([sales amount],desc) ), data[year])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hi @amitchandak,

Thanks for your response. Unfortunately, I can't get it right with your code. It seems to be a problem with the AddColumns part. 
Do you have any further suggestions? 

Many thanks!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.