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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
carloshluiz
Regular Visitor

Help the Formula Count

Hello guys.

I need to create a rule that tells me if there are 3 or more PN's for the same Case Number.

If it is 3 or more, you need to reform the message: "Call the TSE"
If below 3: "Follow with Service"

Thanks.

Ejemplo:

carloshluiz_0-1667832291163.png

 

1 ACCEPTED SOLUTION

Hi @carloshluiz ,

You seem to have created a calculated column, if you want a calculated column, try like:

Result = 
VAR _COUNT =
    CALCULATE (
        DISTINCTCOUNT ( 'Parts Order Line'[PN] ),
        FILTER (
            ALL ( 'Parts Order Line' ),
            'Parts Order Line'[CaseNumber] = EARLIER ( 'Parts Order Line'[CaseNumber] )
        )
    )
VAR _RESULT =
    IF ( _COUNT >= 3, "Call the TSE", "Follow with Service" )
RETURN
    _RESULT

vcgaomsft_0-1667893060104.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

View solution in original post

5 REPLIES 5
Tahreem24
Super User
Super User

@carloshluiz try this measure:

Result =
VAR Count_ = CALCULATE(Count('Table'[PN]),ALLEXCEPT('Table','Table'[Case Number]))
RETURN if(Count_>=3,"Call the TSE","Follow with Service")
Capture.JPG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
mangaus1111
Solution Sage
Solution Sage

Hi @carloshluiz ,

I send you my pbi file with a simplified model. Do you have other columns in your table?

https://1drv.ms/u/s!Aj45jbu0mDVJiz-8PUm2VToAVzL2?e=DekHub

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

 

 

mangaus1111
Solution Sage
Solution Sage

Hi @carloshluiz ,

try this measure

Measure = 
VAR _CurrentCase = SELECTEDVALUE('Facts51'[Case Number])
VAR A =
COUNTROWS(
         FILTER(ALL('Facts51'),
                'Facts51'[Case Number] = _CurrentCase
         )
)
RETURN
SWITCH(TRUE(),
       A>=3,"Call the TSE",
       "Follow with Service"
)

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

It didn't work, only an answer appeared.


Measure =
VAR _CurrentCase = SELECTEDVALUE('Parts Order Line'[CaseNumber])
VAR A =
COUNTROWS(
         FILTER(ALL('Parts Order Line'[CaseNumber]),
                'Parts Order Line'[CaseNumber] = _CurrentCase
         )
)
RETURN
SWITCH(TRUE(),
       A>=3,"Call the TSE",
       "Follow with Service"
)


carloshluiz_0-1667836939466.png

 

Hi @carloshluiz ,

You seem to have created a calculated column, if you want a calculated column, try like:

Result = 
VAR _COUNT =
    CALCULATE (
        DISTINCTCOUNT ( 'Parts Order Line'[PN] ),
        FILTER (
            ALL ( 'Parts Order Line' ),
            'Parts Order Line'[CaseNumber] = EARLIER ( 'Parts Order Line'[CaseNumber] )
        )
    )
VAR _RESULT =
    IF ( _COUNT >= 3, "Call the TSE", "Follow with Service" )
RETURN
    _RESULT

vcgaomsft_0-1667893060104.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly -- How to provide sample data

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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