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.
Hi all,
Can you help me on this SQL query. I need to get only the first value or highest values by PH.pledgeid
select max(PH.pledgeid), BH.BATCHDESCRIPTION, count (BH.BATCHDESCRIPTION) as BDCount from PH
inner join BD on BD.SERIALNUMBER = PH.SERIALNUMBER and BD.SOURCECODE = PH.SOURCECODE
inner join BH on BH.ADMITNAME = BD.ADMITNAME
WHERE PH.PAYMENTTYPE ='Standing Order' and BATCHDESCRIPTION<>'Refunds Paid'
and PH.SERIALNUMBER in (Select SERIALNUMBER from C
where BLOCKPURCHASESREASON = 'Migrate')
Group By PH.pledgeid, BH.BATCHDESCRIPTION
Order by count (BH.BATCHDESCRIPTION) DESC
You can see the example below and I need only the highest for this pledge id
Many thanks
ado
Hi, @adoalan ;
You need to find the maximum value with dax, right, if so, you can try:
max =
CALCULATE ( MAX ( 'table'[count] ), ALLEXCEPT ( 'table', 'table'[pledge id] ) )
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi
I needed in SQL not in power BI
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
101 | |
86 | |
64 |