Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredJoin us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.
i have the following data
| order | stauts |
| 216 | submited |
| 216 | accepted |
| 217 | submited |
| 217 | resumited |
| 217 | accepted |
i need to count the number of orders that got accepted without being reaplied so in this case it should give one order
please help and thank you
Solved! Go to Solution.
Hi @mina97 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Flag =
VAR _tab1 =
CALCULATETABLE (
VALUES ( 'Table'[order] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[stauts] = "accepted" )
)
VAR _tab2 =
CALCULATETABLE (
VALUES ( 'Table'[order] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[order]
IN _tab1
&& 'Table'[stauts] = "resumited"
)
)
VAR _tab =
EXCEPT ( _tab1, _tab2 )
RETURN
IF ( SELECTEDVALUE ( 'Table'[order] ) IN _tab, 1, 0 )Number of orders = SUMX(VALUES('Table'[order]),[Flag])
Best Regards
i used the same data as you it did NOT 😐
okay thank you for trying some one else will help as i wish hopfully
Hi @mina97 ,
I created a sample pbix file(see the attachment), please check if that is what you want.
Flag =
VAR _tab1 =
CALCULATETABLE (
VALUES ( 'Table'[order] ),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[stauts] = "accepted" )
)
VAR _tab2 =
CALCULATETABLE (
VALUES ( 'Table'[order] ),
FILTER (
ALLSELECTED ( 'Table' ),
'Table'[order]
IN _tab1
&& 'Table'[stauts] = "resumited"
)
)
VAR _tab =
EXCEPT ( _tab1, _tab2 )
RETURN
IF ( SELECTEDVALUE ( 'Table'[order] ) IN _tab, 1, 0 )Number of orders = SUMX(VALUES('Table'[order]),[Flag])
Best Regards
you are missing the point 🙂 if i wanted this output i would have done it myself 🙂
wrong it gives 0 😞
Hi, @mina97
try below just adjust your table aand column name
sorry but the output is wrong ..... it deleted the resubmitted row but it still counted the order as accepted from the first time ... the out put is = 4 where it should be 1
Hi, I am a bit busy these days. I will reply ASAP.
Thanks
Proud to be a Super User!
Hi, @mina97
I tried to solve this. here is the output.
AcceptedOrdersWithoutResubmit =
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[stauts] = "accepted" &&
NOT (
CALCULATE(
COUNTROWS('Table'),
FILTER(
'Table',
'Table'[order] = EARLIER('Table'[order]) &&
'Table'[stauts] = "resumited"
)
) > 0
)
)
)
Proud to be a Super User!
hey i am really happy with the code BUT i need it to count the distict number of orders 😞
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 3 | |
| 3 | |
| 3 |