Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi All,
This is my SQL query,
SELECT count(*) as success_count FROM (SELECT `server_name` FROM `windows_linux_patch` where `status`='Successful' AND `server_name` NOT IN(SELECT `server_name` FROM `windows_linux_patch` WHERE `status` = 'Failed' group by `server_name` ) group by `server_name`) AS success_count ;
I have tried to convert up to below, But I am struggling an how to apply subquery in the below conditions.
Success_Counts =
CALCULATE (
DISTINCTCOUNT ( windows_linux_patch[server_name] ),
FILTER (
windows_linux_patch,
windows_linux_patch[status] = "Successful"
),
GROUPBY(
windows_linux_patch,
windows_linux_patch[server_name])
)
Kindly give your support. I am waiting for your updates.
Solved! Go to Solution.
Hi @Anonymous ,
SELECT count(*) FROM table_name WHERE field_name = 'abc'
equal to
CALCUALTE( count('table_name'), FILTER( 'table_name', field_name = 'abc'))
Maybe some differents depend on sepecial situation. In your case try this:
Success_count =
VAR _Failed =
CALCULATETABLE (
VALUES ( 'windows_linux_patch'[server_name] ),
FILTER ( 'windows_linux_patch', [status] = 'Failed' )
)
VAR _Succ =
CALCULATETABLE (
VALUES ( 'windows_linux_patch'[server_name] ),
FILTER (
'windows_linux_patch',
[status] = 'Successful'
&& NOT ( [server_name] IN _Failed )
)
)
RETURN
COUNTROWS ( _Succ )
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous ,
SELECT count(*) FROM table_name WHERE field_name = 'abc'
equal to
CALCUALTE( count('table_name'), FILTER( 'table_name', field_name = 'abc'))
Maybe some differents depend on sepecial situation. In your case try this:
Success_count =
VAR _Failed =
CALCULATETABLE (
VALUES ( 'windows_linux_patch'[server_name] ),
FILTER ( 'windows_linux_patch', [status] = 'Failed' )
)
VAR _Succ =
CALCULATETABLE (
VALUES ( 'windows_linux_patch'[server_name] ),
FILTER (
'windows_linux_patch',
[status] = 'Successful'
&& NOT ( [server_name] IN _Failed )
)
)
RETURN
COUNTROWS ( _Succ )
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thanks for your support and your response.
@Anonymous , try a measure like
Countx(filter(summarize(windows_linux_patch, windows_linux_patch[server_name] , "_1" , countrows(filter(windows_linux_patch, windows_linux_patch[status] = "Successful" )) , "_2" , countrows(filter(windows_linux_patch, windows_linux_patch[status] = "Failed" ))), Not(isblank(_1)) && isblank(_2)))
Thanks for your support and your response.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |