Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I'm trying to make DAX formule from something simple in SQL but I don't get it.
This is the select statement:
select distinct rav_accountid
from rav_orderhistory
where rav_fiscalyear = 2022
and rav_accountid not in (
(select distinct rav_accountid
from rav_orderhistory
where rav_fiscalyear = 2021))
;
I can count the accounts for 2022 and I can count the ones for 2021, but not the account that exist in 2022 minus the accounts of 2021.
Is there perhaps a website or an app that can convert SQL to DAX?
Solved! Go to Solution.
You can use VALUES and EXCEPT, along the lines of
Num new in 2022 =
var accounts2021 = CALCULATETABLE( VALUES('Table'[Account ID]), 'Table'[Year created] = 2021)
var accounts2022 = CALCULATETABLE( VALUES('Table'[Account ID]), 'Table'[Year created] = 2022)
return COUNTROWS( EXCEPT( accounts2022, accounts2021) )
You can use VALUES and EXCEPT, along the lines of
Num new in 2022 =
var accounts2021 = CALCULATETABLE( VALUES('Table'[Account ID]), 'Table'[Year created] = 2021)
var accounts2022 = CALCULATETABLE( VALUES('Table'[Account ID]), 'Table'[Year created] = 2022)
return COUNTROWS( EXCEPT( accounts2022, accounts2021) )
Hi John,
Thank you very much, I was actually pretty close, just couldn't exactly nail it.
kind regards,
Vera
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
18 | |
15 | |
12 | |
11 | |
8 |
User | Count |
---|---|
24 | |
18 | |
12 | |
11 | |
10 |