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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
igorpereiradaco
Frequent 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
Super User
Super User

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
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.