The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends September 15. Request your voucher.
I have 2 tables from a data source
Table A(Data Source)
A | 10 |
B | 12 |
C | 13 |
D | 14 |
E | 15 |
F | 16 |
G | 17 |
Table B(Data Source)
A | 10-MAR |
C | 20-APR |
D | 31-MAY |
G | 26-DEC |
I have 2 table Visuals in power bi
I have go through all the Name fields in Table A(Data source) and check if that Name is in Table B(Data Source)
If the name is present in Table B (Data Source) send that name to Table 1 (Visual) else send that to Table 2 (Visual)
I'm finding difficulty in creating DAX measure to make this work in power bi.
Solved! Go to Solution.
Here you go. I put them in the same table visual with the TableA[Name] column, but you can duplicate the table and use one measure in each.
Is In Table B =
VAR Brows =
CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
IF ( Brows > 0, "Y" )
Is Not In Table B =
VAR Brows =
CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
IF ( ISBLANK(Brows), "Y" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Here you go. I put them in the same table visual with the TableA[Name] column, but you can duplicate the table and use one measure in each.
Is In Table B =
VAR Brows =
CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
IF ( Brows > 0, "Y" )
Is Not In Table B =
VAR Brows =
CALCULATE ( COUNTROWS ( TableB ), TableB[Name] IN VALUES ( TableA[Name] ) )
RETURN
IF ( ISBLANK(Brows), "Y" )
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
This is doable with two DAX measures, but why not just merge the two tables. Where a name exists in B, you'll have data in those columns expanded from B, and where it doesn't you won't. You can then make two table visuals and use a visual filter to either show the blank values or everything but the blank values.
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Thanks for that Pat, but the data comes from 2 different sources and I'm loading the data using DirectQuery rather than Import. When trying to merge those tables I get the error "This step result in a query that is not supported in DirectQuery mode". So I thought using DAX would be appropriate solution for this and was facing difficulty in creating those DAX measures.
If possible could you please help me with those DAX measures?
User | Count |
---|---|
69 | |
66 | |
62 | |
48 | |
28 |
User | Count |
---|---|
112 | |
81 | |
66 | |
54 | |
43 |