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
igorpereiradaco
Regular Visitor

help to solve logical problem

I would like to create a condition in DAX that allows me to display the status of the item based on the scenario associated with it and the status of the tests associated with that scenario.

The proposal is that, if the tests linked to a given scenario are approved, then the scenario must be marked as "ok".

Additionally, if all scenarios linked to an item are marked as "ok", then the item is also marked as "ok".

 

igorpereiradaco_1-1711240053258.png

 

2 ACCEPTED SOLUTIONS
10 REPLIES 10
talespin
Solution Sage
Solution Sage

Friend, good afternoon.

 

What would it look like if I wanted to assign more status to the scenarios and items, as below:

 

if all tests are "Prevented user test" then scenario of the item "Prevented user test"

if all tests are "Not tested" then item scenario 'Not tested"

if all tests are "Prevented" then item scenario "Not tested"

if all tests are "In user testing" then scenario of the item "In user testing"

if all tests are "Approved" then scenario of the item "Approved"

 

 

if all scenarios are "Prevented user test" then test the item "Prevented user test"

if all scenarios are "Not tested" then test the item 'Not tested"

if all scenarios are "Prevented" then test the item "Not tested"

if all scenarios are "Under test" then test the item "Under test"

if all scenarios are "Approved" then test the item "Approved"

 @igorpereiradaco 

 

This should do it. I noticed one thing, you have 

if all tests are "In user testing" then scenario of the item "In user testing"

if all scenarios are "Under test" then test the item "Under test"

 

ScenarioStatus =
VAR _MinVal = CALCULATE(
                        MIN(LogicalProblem[Column1]),
                        REMOVEFILTERS(),
                        VALUES(LogicalProblem[Scenario])
                    )
VAR _MaxVal = CALCULATE(
                        MAX(LogicalProblem[Column1]),
                        REMOVEFILTERS(),
                        VALUES(LogicalProblem[Scenario])
                    )                  
RETURN IF(
            _MinVal = _MaxVal,
            IF(_MaxVal = "Prevented", "Not tested", _MaxVal),
            "NA"
        )
-----------------------------------------------------------------------------
ItemStatus =
VAR _MinVal = CALCULATE(
                        MIN(LogicalProblem[Column1]),
                        REMOVEFILTERS(),
                        VALUES(LogicalProblem[ItemID])
                    )
VAR _MaxVal = CALCULATE(
                        MAX(LogicalProblem[Column1]),
                        REMOVEFILTERS(),
                        VALUES(LogicalProblem[ItemID])
                    )                  
RETURN IF(
            _MinVal = _MaxVal,
            IF(_MaxVal = "Prevented", "Not tested", _MaxVal),
            "NA"
        )
 
File Link:

Can you send me the pbix? Thank you very much, friend.

Thank you for your support

 

talespin
Solution Sage
Solution Sage

hi @igorpereiradaco 

 

Please try these measures

 

ScenarioStatus =
VAR _MinVal = CALCULATE( MINX(LogicalProblem, IF(LogicalProblem[Column1] = "ok", 1 , 0) ), REMOVEFILTERS(), VALUES(LogicalProblem[Scenario]) )
RETURN IF(_MinVal = 1, "ok", "Not ok")
 
ItemStatus =
VAR _MinVal = CALCULATE( MINX(LogicalProblem, IF(LogicalProblem[Column1] = "ok", 1 , 0) ), REMOVEFILTERS(), VALUES(LogicalProblem[ItemID]) )
RETURN IF(_MinVal = 1, "ok", "Not ok")
 
talespin_0-1711257647138.png

 

Good morning. Thanks for the feedback. The solution is this. Can you send me this pbix file?

AnalyticPulse
Continued Contributor
Continued Contributor

do the following:

Create a Calculated Column for Scenario Status

Scenario Status = VAR ScenarioID = 'YourTableName'[Scenario] RETURN IF ( COUNTROWS ( FILTER ( 'YourTableName', [Cenario] = ScenarioID && [Teste Status] <> "Approved" ) ) = 0, "Ok", "Not Ok" )

 

 Create a Calculated Column for Item Status

Item Status = VAR ItemID = 'YourTableName'[Item ID] RETURN IF ( COUNTROWS ( FILTER ( 'YourTableName', [Item ID] = ItemID && [Scenario Status] <> "Ok" ) ) = 0, "Ok", "Not Ok" )

 

If this helped, Follow this blog for more insightful information about data analytics
https://analyticpulse.blogspot.com/
Please Subscribe AnalyticPulse on YouTube for future updates:
https://www.youtube.com/@AnalyticPulse
Please subscribe CogniJourney On Youtube For Daily fun facts:
https://www.youtube.com/@CogniJourney

Good morning. Thanks for the feedback. I couldn't do it that way.

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.