cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

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

Accepted Solutions
Highlighted
Memorable Member
Memorable Member

Re: sum of a conditional result

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
Highlighted
Memorable Member
Memorable Member

Re: sum of a conditional result

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

Highlighted
Community Support
Community Support

Re: sum of a conditional result

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

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors