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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RanHo
Helper V
Helper V

Need help - PowerBi ( Measure base on Classification)

Good day Guys! 

I have a problem here wherein im going to get this Output: 

claim date - file date = SLA DAYS
If the AMOUNT and SLA Days meet the category then it will PASSED otherwise it will mark FAILED.

output.PNG
base on this category/ classification:
base.PNG

 

can someon help me how ? Thanks in Advance.  

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @RanHo ,

In your snapshot above, if the CLASS column is calculated based on the amount compare with Table 2, then the CLASS of FILES NO 800001 should be C, as its amout is above 150K, and its remarks should be failed.

Here's my solution.

Method1

REMARKS =
SWITCH (
    TRUE (),
    'Table'[CLASS] = "A"
        && 'Table'[SLA DAYS] = 1, "PASSED",
    'Table'[CLASS] = "B"
        && 'Table'[SLA DAYS] IN { 2.3 }, "PASSED",
    'Table'[CLASS] = "C"
        && 'Table'[SLA DAYS] IN { 3, 4, 5 }, "PASSED",
    "FAILED"
)

 Method2

REMARKS2 = 
SWITCH (
    TRUE (),
    MAX ( 'Table'[AMOUNT] ) < 50000
        && 'Table'[SLA DAYS] = 1, "PASSED",
    MAX ( 'Table'[AMOUNT] ) >= 50000
        && MAX ( 'Table'[AMOUNT] ) <= 150000
        && 'Table'[SLA DAYS] IN { 2.3 }, "PASSED",
    MAX ( 'Table'[AMOUNT] ) > 150000
        && 'Table'[SLA DAYS] IN { 3, 4, 5 }, "PASSED",
    "FAILED"
)

vkalyjmsft_0-1637829032717.png

I attached my sample bellow to help you understand.

 

Best Regards,
Community Support Team _ kalyj

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

8 REPLIES 8
v-yanjiang-msft
Community Support
Community Support

Hi @RanHo ,

In your snapshot above, if the CLASS column is calculated based on the amount compare with Table 2, then the CLASS of FILES NO 800001 should be C, as its amout is above 150K, and its remarks should be failed.

Here's my solution.

Method1

REMARKS =
SWITCH (
    TRUE (),
    'Table'[CLASS] = "A"
        && 'Table'[SLA DAYS] = 1, "PASSED",
    'Table'[CLASS] = "B"
        && 'Table'[SLA DAYS] IN { 2.3 }, "PASSED",
    'Table'[CLASS] = "C"
        && 'Table'[SLA DAYS] IN { 3, 4, 5 }, "PASSED",
    "FAILED"
)

 Method2

REMARKS2 = 
SWITCH (
    TRUE (),
    MAX ( 'Table'[AMOUNT] ) < 50000
        && 'Table'[SLA DAYS] = 1, "PASSED",
    MAX ( 'Table'[AMOUNT] ) >= 50000
        && MAX ( 'Table'[AMOUNT] ) <= 150000
        && 'Table'[SLA DAYS] IN { 2.3 }, "PASSED",
    MAX ( 'Table'[AMOUNT] ) > 150000
        && 'Table'[SLA DAYS] IN { 3, 4, 5 }, "PASSED",
    "FAILED"
)

vkalyjmsft_0-1637829032717.png

I attached my sample bellow to help you understand.

 

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot! Really appreciate it.

Nice, your solution works, thanks to you thats a big help!
And sorry 'bout my error on my example. 

Many thanks to you!

RanHo
Helper V
Helper V

Is it possible to do it on Dax

IF(ESTIMATE RANGE = A AND SLA DAYS =0 and < 1), "PASSED"

 

ELSE
(ESTIMATE RANGE = B AND SLA DAYS >2 and <3), "PASSED"

 

ELSE "FAILED"

suggestions and advice might help, thanks!



Yes @RanHo 

 

If you could send sample .pbix that demonstrate what you are looking to get. It would really help providing you a quick solution.

 

 

Regards

Kumail Raza

RanHo
Helper V
Helper V

@amitchandak  

this is the one I tried , the result is no visual/error
dax.PNG

 

Is my dax wrong ? Thanks

Kumail
Post Prodigy
Post Prodigy

Hello @RanHo 

 

If you could send sample .pbix that demonstrate what you are looking to get. It would really help providing you a quick solution.

 

Regards

Kumail Raza

amitchandak
Super User
Super User

@RanHo , You can create a new measure

 

Swirch( True(),

[SLA] =1 && [Amount] < 50000, "A",

[SLA] =1 && [Amount] < 150000, "B",

[SLA] =1 && [Amount] >= 150000, "C",

// Add other conditions

)

 

You may also need to check binning

 

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.