March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hi there, first time poster, im hoping someone can tell me whats going on here.
Ok so in my project i am using a measurment with this code
========================================
var TestResultCount = COUNTROWS(TestConducted)
var FailRowCount = (COUNTROWS(aTable))
return
IF(TestResultCount >0,if(FailRowCount < 1,"Yes","No"),"NA")
========================================
so the output im expecting is
If there are tests, return yes, or No if the test succeeded of not. Or Return NA if there are no tests.
In the specific data set i am using there are no Fail cases, and 50% success and 50% NA
the issue i have is the above logic runs without error returning 100% NA
However if the line is changed to
IF(TestResultCount >0,if(True()< 1,"Yes","No"),"NA")
i get my expected results with 50% of the results returning "Yes" and 50% returning "NA"
I believe this is because aTable is blank, however using Isblank(aTable )
EG. IF(TestResultCount >0,if(Isblank(aTable ),"Yes","No"),"NA")
Also doesnt work. with all results still returning NA.
I believe that when the success result of the first if statement hits an error, it instead of stopping just goes to NA.
Please let me know your thoughts and opinions on why this is happening.
Below is the full code
=======================================================
========================================================
Solved! Go to Solution.
Ok the issue is solved.
Ok the issue is solved.
@Anonymous ,Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Hi @Anonymous
Is this a measure or a calculated column ? If the former, how/where are you using it?
What is this? What are you trying to do?
'Hourly Telem Data'[SiteRef] == [SiteRef]
It would help if you show a sample of the relevant tables
Try this for the time being:
Test_Flow status Minus Below peak level =
VAR TestConducted =
FILTER (
'Hourly Telem Data',
AND (
'Hourly Telem Data'[Flow status Minus Below peak level] <> "",
'Hourly Telem Data'[SiteRef] = EARLIER ( 'Hourly Telem Data'[SiteRef] )
)
)
VAR aTable =
FILTER (
TestConducted,
AND (
'Hourly Telem Data'[Flow status Minus Below peak level] == "Fail",
'Hourly Telem Data'[SiteRef] = EARLIER ( 'Hourly Telem Data'[SiteRef] )
)
)
VAR TestResultCount =
COUNTROWS ( TestConducted )
VAR FailRowCount =
COUNTROWS ( aTable )
RETURN
IF ( TestResultCount > 0, IF ( FailRowCount < 1, "Yes", "No" ), "NA" )
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
the code i have constructed is for a measure.
The measure is meant to look over the "Flow status minus below peak level" field in the "Hourly Telem Data" .If the field is not entirely blank, state wheather or not there is one or more "Fail"s in that data set
The measure is set in a different table than "Hourly Telem Data", one which has a unque set of SIte refs, as well as all the other test Measures i need.
'Hourly Telem Data'[SiteRef] == [SiteRef]
This is used to connect the hourly Telem data set to the current tables SiteRef Key
as there is a one to many relationship between the current table and the Hourly Telem Data table.
I tried your solution, power bi wouldn't except the use of the Earlier function stating incorrect paramater type.
@Anonymous if you test just your TestResultCount, does it produce the correct number?
Also, please refrain from topics in all capital 🙂
Yeah TestResultCount does.
Sure thing.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
124 | |
89 | |
84 | |
70 | |
51 |
User | Count |
---|---|
206 | |
146 | |
97 | |
79 | |
69 |