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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
JorgePereira
Helper I
Helper I

sum of a conditional result

I have a "Status" measure that shows the result in the "Status" column. Now I need to add all the statuses "Postergado", "Mantido", "Economia", .... Can you help me how do I measure this?

 

Status Measure.png

 

I need this result below: a sum of the "Diferença 2020" values (difference 2020) by status.

Output Status.PNG

1 ACCEPTED SOLUTION
vivran22
Community Champion
Community Champion

Hello @JorgePereira ,

 

As per my understanding, you can achieve this by creating a calculated table instead.

 

I have used the following steps:

 

Sample data:

 

1.JPG

 

Created following measures:

Total Orders = SUM(dtTable[Order Quantity])

Category = 
IF(
    [Total Orders] < 50,
    "Less than 50",
        IF([Total Orders] < 100,
        "b/w 50 & 100",
            IF([Total Orders] < 120,
                "b/w 100 & 120",
                "More than 120"
                )
        )
)

 

So, I can create visuals like this:

2.JPG

 

Then, created the calculated table:

 

Table = 
SUMMARIZE(
    dtTable,
    dtTable[Product Sub-Category],
    "Total ORders",[Total Orders],
    "Category",[Category]
)

 

3.JPG

 

Which can be used in the visual

4.JPG

 

Hope this helps.

 

Cheers!

Vivek


If it helps, please mark it as a solution

Kudos would be a cherry on the top 🙂

(Hit the thumbs up button!)


If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


Visit my blog:

vivran.in/my-blog


Feel free to email me for any BI needs .


Connect on LinkedIn

Follow on Twitter


View solution in original post

2 REPLIES 2
v-gizhi-msft
Community Support
Community Support

Hi,

 

Please take following steps:

1)Create a slicer table as below by Enter Data:

1.PNG

2)Try this measure:

Measure = 
SWITCH (
    SELECTEDVALUE ( 'Slicer Table'[Category] ),
    "Antecipado", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Status] = "Antecipado" ) ),
    "Postergado", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Status] = "Postergado" ) ),
    "Mantido", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Status] = "Mantido" ) ),
    "Maior", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Status] = "Maior" ) ),
    "Economia", CALCULATE ( COUNTROWS ( 'Table' ), FILTER ( 'Table', [Status] = "Economia" ) )
)

3)The result shows:

2.PNG

See my attached pbix file.

 

Best Regards,

Giotto

vivran22
Community Champion
Community Champion

Hello @JorgePereira ,

 

As per my understanding, you can achieve this by creating a calculated table instead.

 

I have used the following steps:

 

Sample data:

 

1.JPG

 

Created following measures:

Total Orders = SUM(dtTable[Order Quantity])

Category = 
IF(
    [Total Orders] < 50,
    "Less than 50",
        IF([Total Orders] < 100,
        "b/w 50 & 100",
            IF([Total Orders] < 120,
                "b/w 100 & 120",
                "More than 120"
                )
        )
)

 

So, I can create visuals like this:

2.JPG

 

Then, created the calculated table:

 

Table = 
SUMMARIZE(
    dtTable,
    dtTable[Product Sub-Category],
    "Total ORders",[Total Orders],
    "Category",[Category]
)

 

3.JPG

 

Which can be used in the visual

4.JPG

 

Hope this helps.

 

Cheers!

Vivek


If it helps, please mark it as a solution

Kudos would be a cherry on the top 🙂

(Hit the thumbs up button!)


If it doesn't, then please share a sample data along with the expected results (preferably an excel file and not an image)


Visit my blog:

vivran.in/my-blog


Feel free to email me for any BI needs .


Connect on LinkedIn

Follow on Twitter


Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.

Users online (11,062)