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
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
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.

Top Solution Authors