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
setis
Post Partisan
Post Partisan

Calculation based on a set of rules

Dear all,

 

I'm not sure how to approach this challenge. 

I have a table with a set of rules:

 

rules.PNG

 

As you can see a case has a specific Fee_type when it meets all the conditions. 

F.Ex. A case is Easywhen the

ft_cause = A and

the case_type = Type_A and

the customer = CustomerA and

Activities <5  and

Nr calls <1.

 

I am looking for a Measure or calculated column in my cases table that gives me right price:

 

result.PNG

 

Any idea on how to approach this?

 

Thanks in advance

1 ACCEPTED SOLUTION

@setis 

 

You may try Pivot Column to shape data in Query Editor and then refer to this post.

 

Community Support Team _ Sam Zha
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

7 REPLIES 7
amitchandak
Super User
Super User

@setis , what is the logic for desired price2 =200 for easy.  Do you need this calculation on the aggerated number or at line level

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

@amitchandak thanks for looking into this. 

 

I'm so sorry, there was a mistake in the table. I have just corrected it in the orogonal post. The easy price is 200.

The calculation I need is on a line level on the cases table. 

 

Thank in advance

@setis , can you provide sample data, sample rule data in table format

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

@amitchandak Sure!

 

Sample rule

 

ft_nameft_causeCase_typeCustomerft_operatornameft_numberFee_typeAmount
CauseME CustomerA  Difficult1000
Case Type Type_ACustomerA  Difficult1000
Customer  CustomerA  Difficult1000
Activities  CustomerALess than5Easy200
CauseME CustomerA  Easy200
Customer  CustomerA  Easy200
Case Type Type_ACustomerA  Easy200
Nr of calls  CustomerALess than1Easy200

 

Sample data

CaseIDft_causeCase_typeCustomerNr of callsNr ActivitiesDesired Result(Fee_type)Desired Result2(price)
1221METype_ACustomerA04Easy200
1222AAType_BCustomerA5 BLANKBLANK
1223METype_ACustomerA06Difficult1000

The weekend sank this post to the bottom of the forum. I'm bumping this to gain some monday morning visibility. 

I would really appreciate any help. 

@setis 

 

You may try Pivot Column to shape data in Query Editor and then refer to this post.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-chuncz-msft thanks for your answer. You are right. That's definitiely the way to go. 

 

I am having issues doing the unpivot in power query. Could you please help me with the steps to unpivot this correctly?

 

I have upload a sample here:  https://drive.google.com/file/d/16wKtLuvvUJ8gMMV5Hk0PYFiEcCR8oAYL/view?usp=sharing

 

What I'm trying to go is from here: 

 

table1.PNG

 

To something like this:

table2.PNG

 

At the same time, do  you have any idea on how to solve the cells Activities and Calls so I have something usable to calculate with?

 

 

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!

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.