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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

re write the following measures as variable

HI Experts

 

how could i consolidate and re write the following three meaure as a varibale as they are taking some time to compuate the output answer...

measure 1.

Cumulative Complaints = CALCULATE([TotalComplaintswithTrends],
FILTER(
ALLSELECTED(PMS_FINANCIAL_PDS),
PMS_FINANCIAL_PDS[Month Start] <= MAX(PMS_FINANCIAL_PDS[Month Start])
))
 
measure 2.
Cumulative Sales = CALCULATE([TotalSalesTrend],
FILTER(
ALLSELECTED(PMS_TM1_SALES_VOLUME),
[Month Start] <= MAX(PMS_FINANCIAL_PDS[Month Start])
))
 
resultant measure is
Cumulative Complaint Rate = IF(DIVIDE([Cumulative Complaints],[Cumulative Sales],0)<>0,DIVIDE([Cumulative Complaints],[Cumulative Sales],0))
+0
1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Maybe the measure should be like below:

Cumulative Complaint Rate =
VAR Cumulative_Complaints =
    CALCULATE (
        [TotalComplaintswithTrends],
        FILTER (
            ALLSELECTED ( PMS_FINANCIAL_PDS ),
            PMS_FINANCIAL_PDS[Month Start] <= MAX ( PMS_FINANCIAL_PDS[Month Start] )
        )
    )
VAR Cumulative_Sales =
    CALCULATE (
        [TotalSalesTrend],
        FILTER (
            ALLSELECTED ( PMS_TM1_SALES_VOLUME ),
            [Month Start] <= MAX ( PMS_FINANCIAL_PDS[Month Start] )
        )
    )
RETURN
    IF (
        DIVIDE ( Cumulative_Complaints, Cumulative_Sales, 0 ) <> 0,
        DIVIDE ( Cumulative_Complaints, Cumulative_Sales, 0 )

 

Community Support Team _ Jimmy Tao

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

3 REPLIES 3
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

Maybe the measure should be like below:

Cumulative Complaint Rate =
VAR Cumulative_Complaints =
    CALCULATE (
        [TotalComplaintswithTrends],
        FILTER (
            ALLSELECTED ( PMS_FINANCIAL_PDS ),
            PMS_FINANCIAL_PDS[Month Start] <= MAX ( PMS_FINANCIAL_PDS[Month Start] )
        )
    )
VAR Cumulative_Sales =
    CALCULATE (
        [TotalSalesTrend],
        FILTER (
            ALLSELECTED ( PMS_TM1_SALES_VOLUME ),
            [Month Start] <= MAX ( PMS_FINANCIAL_PDS[Month Start] )
        )
    )
RETURN
    IF (
        DIVIDE ( Cumulative_Complaints, Cumulative_Sales, 0 ) <> 0,
        DIVIDE ( Cumulative_Complaints, Cumulative_Sales, 0 )

 

Community Support Team _ Jimmy Tao

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

Try

//Option 1
averagex(summarize(FILTER(
ALLSELECTED(PMS_FINANCIAL_PDS),
[Month Start] <= MAX(PMS_FINANCIAL_PDS[Month Start])
),"_1",[TotalComplaintswithTrends],"_2",[TotalSalesTrend]),divide([_1],[_2]))

//Option 2
averagex(summarize(calculatetable(PMS_FINANCIAL_PDS,FILTER(
ALLSELECTED(PMS_FINANCIAL_PDS),
[Month Start] <= MAX(PMS_FINANCIAL_PDS[Month Start])
)),"_1",[TotalComplaintswithTrends],"_2",[TotalSalesTrend]),divide([_1],[_2]))
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 Amit..
The second messure reference the sales table, both measures are not the same PMS_Financial_PDS..

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors