Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Did you hear? There's a new SQL AI Developer certification (DP-800). Start preparing now and be one of the first to get certified. Register now

Reply
cdavis24
Regular Visitor

Token Comma Expected Error

Hi!  I'm trying to see the records in common between the table ending in '2v' and the one ending in '2v_prior' from the query below.  When I copy/paste working code directly from SQL Server Management Studio to a blank Power BI query screen, Power BI transforms it, and I get the following, which results in a Token Comma Error:

 

= select * from ro.eria_Details_2v a#(cr)#(lf)where exists (select period, risk_inventory_id from ro.ERIA_Details_2v_Prior b#(cr)#(lf)where a.risk_inventory_id = b.risk_inventory_id)#(cr)#(lf)and a.period = "Q4 2022"

 

What, within the query, would give me that error?

1 ACCEPTED SOLUTION

NewTable=CALCULATETABLE(ro.eria_Details_2v_prior,NOT(CONTAINSROW(SUMMARIZE(ro.ERIA_Details_2v,ro.ERIA_Details_2v[period],ro.ERIA_Details_2v[risk_inventory_id]),ro.eria_Details_2v_prior[period],ro.eria_Details_2v_prior[risk_inventory_id])))

View solution in original post

3 REPLIES 3
wdx223_Daniel
Community Champion
Community Champion

=let a=List.Buffer(List.Distinct(ro.ERIA_Details_2v_Prior[risk_inventory_id])) in Table.SelectRows(ro.eria_Details_2v,each [period]="Q4 2022" and List.Contains(a,[risk_inventory_id]))

So, I'm basically trying to understand how I can write a DAX query which is synonymous with my SQL Server query.  I have 2 tables, and I'm trying to understand how I can count the records which existed on the prior table (the table named ro.ERIA_Details_2v_Prior) but don't exist on the current table (the one named ro.ERIA_Details_2v).  The query below works perfectly in SQL Server, as I'm able to see which records are missing and understand the counts.  I need to replicate it in DAX, but I'm having trouble:

 

select * from ro.eria_Details_2v_prior a

where not exists (select period, risk_inventory_id, from ro.ERIA_Details_2v b

where a.risk_inventory_id = b.risk_inventory_id and b.period = 'Q4 2022')

NewTable=CALCULATETABLE(ro.eria_Details_2v_prior,NOT(CONTAINSROW(SUMMARIZE(ro.ERIA_Details_2v,ro.ERIA_Details_2v[period],ro.ERIA_Details_2v[risk_inventory_id]),ro.eria_Details_2v_prior[period],ro.eria_Details_2v_prior[risk_inventory_id])))

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.