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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
elseoutzen
Regular Visitor

Measure has too long respond time.

I have a report where 1 measure gives me too long repsons time and I can not figure out who to do this better. 

(result is correct)

 

I have 4 files   CAP (fact)  and SALES (fact) + date table + CUSTOMER table

 

Relationships: : 

CAP to date (many to one)

SALES to date (many to one)

CAP to CUSTOMER (many to one)

SALES to CUSTOMER (many to one)

 

6 measures:

NS : CALCULATE(SUM(SALES[netsales])) 

Sales FY22 = CALCULATE([NS], FILTER(ALL('DATE'),'DATE'[Fiscal Year] = 2022))

SALES YTD = TOTALYTD(CALCULATE([NS]),'DATE'[DATE],"6-30")

#CAP = CALCULATE(DISTINCTCOUNT('CAP'[CustomerID]),'CAP[ACTIVTY]>0)  

#CAP active 2Y= calculate([#CAP], filter('CUSTOMER',[sales FY22]>1||[SALES YTD]>1))

 

Below last measure is the problem:  (I want to find the YTD sales comming from "customers with CAP Active 2Y" )

 

Sales YTD from “#CAP Active 2Y = calculate([sales YTD],FILTER('CUSTOMER',[ #CAP active 2Y]=1))

 

Anyone who has an idea how to do this better? 

 

Thanks 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@elseoutzen , Try like

 

SUmx(filter('CUSTOMER',[sales FY22]>1||[SALES YTD]>1),[#CAP])

 

or

 

SUmx(filter(values('CUSTOMER'[Customer]) ,[sales FY22]>1||[SALES YTD]>1),[#CAP])

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@elseoutzen , Try like

 

SUmx(filter('CUSTOMER',[sales FY22]>1||[SALES YTD]>1),[#CAP])

 

or

 

SUmx(filter(values('CUSTOMER'[Customer]) ,[sales FY22]>1||[SALES YTD]>1),[#CAP])

This works perfect, Thank you so much 🙂 very helpful

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.