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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
noanowa
New Member

More Efficient Calculation for Multiple Measure

Hello Everyone,

 

I'm still new to power BI and having issues in calculating multiple calculation. I have been using below DAX script to switch between multiple measures.

 

 

Revenue Slab = 
IF (
    HASONEVALUE ('Range'[Range] ),
    SWITCH (
        VALUES ('Range'[Range] ),
        "1. 1 - 199k", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>0,file[Total Revenue]<200000))),
        "2. 200k - 499k", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>=200000,file[Total Revenue]<500000))),
        "3. 500k - 4.99M", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>=500000,file[Total Revenue]<5000000))),
        "4. 5M - 49.9M", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>=5000000,file[Total Revenue]<500000000))),
        "5. 50M - 499M", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>=50000000,file[Total Revenue]<500000000))),
        "6. 500M - 1.99B", calculate(file[Total Revenue], filter(file,and(file[Total Revenue]>=500000000,file[Total Revenue]<2000000000))),
        "7. > 2B", calculate(file[Total Revenue], filter(file,file[Total Revenue]>=500000000))
        , file[Total Revenue]
    )
)

 

 

And then I create new table as a relation table, to call above measure as follow.

 

Range

1. 1 - 199k
2. 200k - 499k
3. 500k - 4.99M
4. 5M - 49.9M
5. 50M - 499M
6. 500M - 1.99B
7. > 2B

 

The problem is that the scripts run pretty slow, and sometimes I faced 'out of memory' error like this:

Resource Governing: This query uses more memory than the configured limit. The query — or calculations referenced by it — might be too memory-intensive to run

 

Is there any alternative way that I can do to make it more efficient?

 

Thank you for your help!

 

note: I'm using excel table with more than 10 million rows.

1 REPLY 1
amitchandak
Super User
Super User

@noanowa , refer if this approach can help

 

Dynamic Segmentation Bucketing Binning
https://community.powerbi.com/t5/Quick-Measures-Gallery/Dynamic-Segmentation-Bucketing-Binning/m-p/1...


Dynamic Segmentation, Bucketing or Binning: https://youtu.be/CuczXPj0N-k

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

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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.

Top Solution Authors