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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
gauravnarchal
Post Prodigy
Post Prodigy

Need help with Measure - Points Calculation

Hello

 

I need your help to create a measure as

 

  • Count “item” from table InvoiceDetails and multiply each item with the points below and show the result in matrix visual.
    • If Hand Made Multiply by 3
    • If Machine Multiply by 5

Result - Matrix Visual 

 

InvoiceNumberHand MadeMachine
831257 5
8312593 
831261 5
8312643 
8312653 
831265 5

 

 

 

Table:- Category

 

InvoiceIDInvoiceDetailIDCategory
9424972534258Machine
9424982534260Hand Made
9424992534268Machine
9425002534270Machine
9425012534272Hand Made
9425022534274Hand Made
9425022539274Machine

 

Table:- InvoiceNumber

 

InvoiceIDInvoiceDetailIDInvoiceDateInvoiceNumber
942497253425811/1/2021 0:00831257
942498253426011/1/2021 0:00831259
942499253426811/1/2021 0:00831260
942500253427011/1/2021 0:00831261
942501253427211/1/2021 0:00831264
942502253427411/1/2021 0:00831265
942502253927411/1/2021 0:00831265

 

Table:- InvoiceDetails

 

InvoiceIDInvoiceDetailIDItem
9424972534258UBY4SL
9424982534260URH/NOV/051121
9424992534268 
94250025342709876865790
94250125342729876865790/91
94250225342749876865789
94250225392749876865689
1 ACCEPTED SOLUTION

Hi @gauravnarchal ,

 

Please try the following measures:

 

Result = 
var _category = 
    CALCULATE ( 
        MAX ( Category[Category] ),
        FILTER ( 
            InvoiceDetails,
            InvoiceDetails[Item] <> BLANK()
        )
    )
return 
    SWITCH(
        _category, 
        "Hand Made", 3,
        "Machine", 5,
        BLANK()
    )
Total_Result = 
IF (
    ISFILTERED ( InvoiceNumber[InvoiceDetailID] ),
    [Result],
    SUMX (
        FILTER ( InvoiceDetails, InvoiceDetails[Item] <> BLANK() ),
        [Result]
    )
)

vkkfmsft_1-1639016855477.png   vkkfmsft_0-1639016819039.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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
amitchandak
Super User
Super User

@gauravnarchal , You can create a new column in Category and use that

 

if([Category] = "Hand Made",3,5)

 

This can be used in measure or displayed as per need

@amitchandak - I want this a measure and with below condition

 

  • Count “item” from table InvoiceDetails and multiply each item with the points below and show the result in matrix visual.
    • If Hand Made Multiply by 3
    • If Machine Multiply by 5

Result - Matrix Visual 

 

InvoiceNumberHand MadeMachineTotal
831257 55
8312593 3
831261 55
8312643 3
8312653 3
831265 55
Grand Total91524

 

Hi @gauravnarchal ,

 

Please try the following measures:

 

Result = 
var _category = 
    CALCULATE ( 
        MAX ( Category[Category] ),
        FILTER ( 
            InvoiceDetails,
            InvoiceDetails[Item] <> BLANK()
        )
    )
return 
    SWITCH(
        _category, 
        "Hand Made", 3,
        "Machine", 5,
        BLANK()
    )
Total_Result = 
IF (
    ISFILTERED ( InvoiceNumber[InvoiceDetailID] ),
    [Result],
    SUMX (
        FILTER ( InvoiceDetails, InvoiceDetails[Item] <> BLANK() ),
        [Result]
    )
)

vkkfmsft_1-1639016855477.png   vkkfmsft_0-1639016819039.png

 

If the problem is still not resolved, please provide detailed error information or the expected result you expect. Let me know immediately, looking forward to your reply.

Best Regards,
Winniz

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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