Forum Discussion

jhonKy0t's avatar
jhonKy0t
Regular Visitor
2 years ago

SQL Management Studio output is not the same with Power BI Visual Table.

I have a query that runs like this:

 

 

SELECT H.TKT_DAT,
	L.ITEM_NO
FROM VI_PS_DOC_HDR H JOIN VI_PS_DOC_LIN L ON H.DOC_ID = L.DOC_ID
	JOIN PO_VEND P ON L.ITEM_VEND_NO = P.VEND_NO  
WHERE H.TKT_TYP = 'T' AND H.DOC_TYP = 'T' AND H.DEP_ONLY_TKT='N' and L.LIN_TYP IN ('S','R')

 

 

When I run it in SQL Management Studio, it outputs only 2 items. But if I run in Power BI it outputs several items.

And even if I output only H.TKT_DAT in the Power BI Visual table, it shows 4 items.

 

I already checked the Power BI relationship of the tables and it seems to be correct. The only difference is the filter in selection of L.LIN_TYP is only "S" because there's no "R" in the row data.

 

 

 

 

 

 

3 Replies

  • jhonKy0t , Try a measure like this

    Calculate( Countrows(Summarize(VI_PS_DOC_LIN , VI_PS_DOC_HDR [TKT_DAT], VI_PS_DOC_LIN[ITEM_NO])), filter(VI_PS_DOC_HDR , [TKT_TYP] = "T" && [DOC_TYP] = "T" && [DEP_ONLY_TKT]="N"), filter(VI_PS_DOC_LIN, VI_PS_DOC_LIN[LIN_TYP] in {"S", "R"}))

     

    Assuming line table is on many side

  • jhonKy0t's avatar
    jhonKy0t
    Regular Visitor

    It just outputs the number of rows in each of the date

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi jhonKy0t ,

     

    I'm guessing you have Include relationship columns checked, and it will return all the associated data.

    Please uncheck the box to try.

     

    Please feel free to correct me and provide more information if I have misunderstood you!

     

    An attachment for your reference. Hope it helps!

     

    Best regards,
    Community Support Team_ Scott Chang

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.