Join 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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
Simple thing.
I am creating virtual table in DAX with filtered data which matches some criterias, then I want to display that data by campaigns, but
in Pivot I see only the particular date I have filtered initially, despite the fact that later I do obtain virtual table with all possible campaigns.
In DAX STUDIO I see that table, but when I create measure using that table in EXCEL POWER PIVOT I see only that campaign I was filtering for...
I tried all stuff I had in my mind but now stuck,what can be wrong...
TABL= just selects data from initial table and breaks lineage for me later to be joined with the list I need.
test - is the list I need. So it represents list of customers on particular campaign. Then I want to see how they perform in future campaigns and I do naturalleftouterjoin with TABL by their ID and DATASET.
Then filter those which I need. THEN use IN DAX measure and I see the table I need- All campaigns, and all customers placed order in particular campaign.
After I copy all this data in EXCEL POWER PIVOT (green window) create measure and want to see it via PIVOT TABLE I see only that campaign they placed order, all other campaigns are not visible.
evaluate
VAR Tabl=selectcolumns(TABLE;
CUST_ID;TABLE[CUST_ID]+0;
DATASET;TABLE[DATASET]&"";
CUST_TYPE;TABLE[CUST_TYPE]+0;
CAMPAIGN;TABLE[CAMPAIGN]&"";
SALES;TABLE[SALES]+0;
ACTIVE;TABLE[ACTIVE]+0;
LOYALTY_GRADE;TABLE[LOYALTY_GRADE]+0;
TAXES;TABLE[TAXES]+0
)
VAR times=SELECTCOLUMNS(FILTER(VALUES(TABLE[CAMPAIGN]);[CAMPAIGN]="2020-04");"CAMPAIGN";[CAMPAIGN]&"";"CAMP_ID";"Y")
VAR test=FILTER(NATURALLEFTOUTERJOIN(Tabl;times);[CAMP_ID]="Y")
VAR LOYALTY_GRADE_APR2020=FILTER(test;[LOYALTY_GRADE]=1)
VAR list_apr20_a=SELECTCOLUMNS(LOYALTY_GRADE_APR2020;"DATASET";[DATASET]&"";"CUST_ID";[CUST_ID]+0;"STATUS";"APR_20";"CAMPAIGN";[CAMPAIGN]&"")
VAR list_apr20=SELECTCOLUMNS(list_apr20_a;"DATASET";[DATASET]&"";"CUST_ID";[CUST_ID]+0;"STATUS";"APR_20")
VAR temp1=NATURALLEFTOUTERJOIN(Tabl;list_apr20)
VAR temp=filter(temp1;[STATUS]<>"")
VAR result=calculate(sumx(temp;[SALES]))
return
calculate(sumx(temp;[SALES]))
What is really happening
Two clean fixes
Fix A minimal change
Make times independent from the current row by using a constant table and push the list of customers back to the base table with TREATAS. This keeps model filters on Campaign working.
Customers in Apr 2020
VAR CustomersApr =
CALCULATETABLE(
SUMMARIZE(
FILTER(
ALL( TABLE ),
TABLE[CAMPAIGN] = "Apr 2020"
&& TABLE[LOYALTY_GRADE] = 1
),
TABLE[DATASET],
TABLE[CUST_ID]
)
)
RETURN CustomersApr
Sales for those customers by any campaign
VAR CustomersApr =
CALCULATETABLE(
SUMMARIZE(
FILTER(
ALL( TABLE ),
TABLE[CAMPAIGN] = "Apr 2020"
&& TABLE[LOYALTY_GRADE] = 1
),
TABLE[DATASET],
TABLE[CUST_ID]
)
)
RETURN
CALCULATE(
SUM( TABLE[SALES] ),
KEEPFILTERS(
TREATAS( CustomersApr, TABLE[DATASET], TABLE[CUST_ID] )
)
)
Put Campaign on rows. The measure will split by the Campaign on the Pivot because the filter now hits the real table through TREATAS. Replace Apr 2020 with your real campaign key.
Fix B keep your pattern but unhook it from the row context
If you really want to keep NATURALLEFTOUTERJOIN then do two things.
Use ALL on Campaign when you build times so it does not depend on VALUES of the current row.
Do not rebuild a copy of the table with SELECTCOLUMNS for columns that need to be filterable. Use the original table in the final SUM or use TREATAS to push your customer list back to the original table.
Example of a constant times table
VAR times =
ROW( "CAMPAIGN", "Apr 2020", "CAMP_ID", "Y" )
Then do your joins, but finish with
RETURN
CALCULATE(
SUM( TABLE[SALES] ),
KEEPFILTERS(
TREATAS( SELECTCOLUMNS( list_apr20, "DATASET", [DATASET], "CUST_ID", [CUST_ID] ),
TABLE[DATASET], TABLE[CUST_ID] )
)
)
Practical debugging steps
Hi @Anonymous ,
According to your statement and code, I know that you will need to use SELECTCOLUMN and NATURALLEFTOUTERJOIN function to build virtual tables and then calculate the result as you want. I think your code is complex, please share a sample file with us and show us a screenshot with the result you want. This will make us easier to understand your requirement.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 9 | |
| 7 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 18 | |
| 16 | |
| 12 | |
| 8 | |
| 5 |