cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dog_d_b
New Member

POWER PIVOT DOES NOT FILTER VIRTUAL TABLE IN EXCEL MODE

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])) 

1 REPLY 1
RicoZhou
Community Support
Community Support

Hi @dog_d_b ,

 

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.

Helpful resources

Announcements
May 23 2022 epsiode 5 without aka link.jpg

The Power BI Community Show

Welcome to the Power BI Community Show! Jeroen ter Heerdt talks about the importance of Data Modeling.

charticulator_carousel_with_text (1).png

Charticulator Design Challenge

Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!

Power BI Dev Camp Session 22 with aka link 768x460.jpg

Check it out!

Mark your calendars and join us on Thursday, May 26 at 11a PDT for a great session with Ted Pattison!

Power BI Release May 2022 768x460.png

Check it out!

Click here to read more about the May 2022 updates!