union
7 TopicsUnion between 2 semantic models
I am trying to create a DAX on Union of 2 existing semantic models but am running into an error "The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value." I have matched the columns from both semantic model & ensured are having same number of columns & names. Below is the union UnionTable = UNION( SELECTCOLUMNS( FX_Data_2022_Onwards, "TRAN_DATE_NEW", FX_Data_2022_Onwards[TRAN_DATE], // TRAN_DATE_NEW aligned "TRAN_DATE_OLD", FX_Data_2022_Onwards[VALUE_DATE], // TRAN_DATE_OLD aligned "TRAN_ID", FX_Data_2022_Onwards[TRAN_ID], "PART_TRAN_TYPE", FX_Data_2022_Onwards[PART_TRAN_TYPE], "GL_SUB_HEAD_CODE", FX_Data_2022_Onwards[GL_SUB_HEAD_CODE], "CIF No", FX_Data_2022_Onwards[CIF No], "Customer Name", FX_Data_2022_Onwards[Customer Name], "FORACID", FX_Data_2022_Onwards[FORACID], "VALUE_DATE", FX_Data_2022_Onwards[VALUE_DATE], "TRAN_PARTICULAR", FX_Data_2022_Onwards[TRAN_PARTICULAR], "REF_NUM", FX_Data_2022_Onwards[REF_NUM], "TRAN_RMKS", FX_Data_2022_Onwards[TRAN_RMKS], "PSTD_DATE", FX_Data_2022_Onwards[PSTD_DATE], "Time", FX_Data_2022_Onwards[Time], "RATE_CODE", FX_Data_2022_Onwards[RATE_CODE], "RATE", FX_Data_2022_Onwards[RATE], "CRNCY_CODE", FX_Data_2022_Onwards[CRNCY_CODE], "TRAN_CRNCY_CODE", FX_Data_2022_Onwards[TRAN_CRNCY_CODE], "TRAN_AMT", FX_Data_2022_Onwards[TRAN_AMT], "REF_CRNCY_CODE", FX_Data_2022_Onwards[REF_CRNCY_CODE], "REF_AMT", FX_Data_2022_Onwards[REF_AMT], "TRAN_AMT_AED", FX_Data_2022_Onwards[TRAN_AMT_AED], "TREA_RATE", FX_Data_2022_Onwards[TREA_RATE], "CCY SLABS", FX_Data_2022_Onwards[CCY SLABS], "Type", FX_Data_2022_Onwards[Type], "MID Rate in USD", FX_Data_2022_Onwards[MID Rate in USD], "Ccy pair", FX_Data_2022_Onwards[Ccy pair], "Base currency", FX_Data_2022_Onwards[Base currency], "Base currency Amount", FX_Data_2022_Onwards[Base currency Amount], "Tran rate (1 Base ccy = x Other ccy)", FX_Data_2022_Onwards[Tran rate(1 Base ccy = x Other ccy)], "Check", FX_Data_2022_Onwards[Check], "Other Ccy", FX_Data_2022_Onwards[Other Ccy], "Other Ccy Amount", FX_Data_2022_Onwards[Other Ccy Amount], "REVERSAL", FX_Data_2022_Onwards[REVERSAL], "Buy/Sell", FX_Data_2022_Onwards[Buy/Sell], "Derived real-time rate", FX_Data_2022_Onwards[Derived real-time rate], "Currency other than AED", FX_Data_2022_Onwards[Currency other than AED], "Amount other than AED", FX_Data_2022_Onwards[Amount other than AED], "Seg profit 1", FX_Data_2022_Onwards[Seg profit 1], "Real time profit-1", FX_Data_2022_Onwards[Real time profit-1], "Currency other than USD", FX_Data_2022_Onwards[Currency other than USD], "Amount other than USD", FX_Data_2022_Onwards[Amount other than USD], "Seg profit 2", FX_Data_2022_Onwards[Seg profit 2], "Real time profit-2", FX_Data_2022_Onwards[Real time profit-2], "Segment Profit (AED)", FX_Data_2022_Onwards[Segment Profit(AED)], "Profit w.r.t real time rate (AED)", FX_Data_2022_Onwards[Profit w.r.t real time rate(AED)], "Difference", FX_Data_2022_Onwards[Difference], "GL Segment", FX_Data_2022_Onwards[GL Segment], "GL Subsegment", FX_Data_2022_Onwards[GL Subsegment], "Sol ID", FX_Data_2022_Onwards[Sol ID], "SOL Desc", FX_Data_2022_Onwards[SOL Desc], "RM Name", FX_Data_2022_Onwards[RM Name], "DELIVERY_CHANNEL_ID", FX_Data_2022_Onwards[DELIVERY_CHANNEL_ID], "Source", "FX_Data_2022_Onwards" ), SELECTCOLUMNS( RMT_CPR, "TRAN_DATE_NEW", RMT_CPR[VALUE_DATE], // Match the first table's TRAN_DATE_NEW "TRAN_DATE_OLD", RMT_CPR[TRAN_DATE], // Match the first table's TRAN_DATE_OLD "TRAN_ID", RMT_CPR[TRAN_ID], "PART_TRAN_TYPE", RMT_CPR[PART_TRAN_TYPE], "GL_SUB_HEAD_CODE", RMT_CPR[GL_SUB_HEAD_CODE], "CIF No", RMT_CPR[CIF No], "Customer Name", RMT_CPR[Customer Name], "FORACID", RMT_CPR[FORACID], "VALUE_DATE", RMT_CPR[VALUE_DATE], "TRAN_PARTICULAR", RMT_CPR[TRAN_PARTICULAR], "REF_NUM", RMT_CPR[REF_NUM], "TRAN_RMKS", RMT_CPR[TRAN_RMKS], "PSTD_DATE", RMT_CPR[PSTD_DATE], "Time", RMT_CPR[Time], "RATE_CODE", RMT_CPR[RATE_CODE], "RATE", RMT_CPR[RATE], "CRNCY_CODE", RMT_CPR[CRNCY_CODE], "TRAN_CRNCY_CODE", RMT_CPR[TRAN_CRNCY_CODE], "TRAN_AMT", RMT_CPR[TRAN_AMT], "REF_CRNCY_CODE", RMT_CPR[REF_CRNCY_CODE], "REF_AMT", RMT_CPR[REF_AMT], "TRAN_AMT_AED", RMT_CPR[TRAN_AMT_AED], "TREA_RATE", RMT_CPR[TREA_RATE], "CCY SLABS", RMT_CPR[CCY SLABS], "Type", RMT_CPR[Type], "MID Rate in USD", RMT_CPR[MID Rate in USD], "Ccy pair", RMT_CPR[Ccy pair], "Base currency", RMT_CPR[Base currency], "Base currency Amount", RMT_CPR[Base currency Amount], "Tran rate (1 Base ccy = x Other ccy)", RMT_CPR[Tran rate(1 Base ccy = x Other ccy)], "Check", RMT_CPR[Check], "Other Ccy", RMT_CPR[Other Ccy], "Other Ccy Amount", RMT_CPR[Other Ccy Amount], "REVERSAL", RMT_CPR[REVERSAL], "Buy/Sell", RMT_CPR[Buy/Sell], "Derived real-time rate", RMT_CPR[Derived real-time rate], "Currency other than AED", RMT_CPR[Currency other than AED], "Amount other than AED", RMT_CPR[Amount other than AED], "Seg profit 1", RMT_CPR[Seg profit 1], "Real time profit-1", RMT_CPR[Real time profit-1], "Currency other than USD", RMT_CPR[Currency other than USD], "Amount other than USD", RMT_CPR[Amount other than USD], "Seg profit 2", RMT_CPR[Seg profit 2], "Real time profit-2", RMT_CPR[Real time profit-2], "Segment Profit (AED)", RMT_CPR[Segment Profit(AED)], "Profit w.r.t real time rate (AED)", RMT_CPR[Profit w.r.t real time rate(AED)], "Difference", RMT_CPR[Difference], "GL Segment", RMT_CPR[GL Segment], "GL Subsegment", RMT_CPR[GL Subsegment], "Sol ID", RMT_CPR[Sol ID], "SOL Desc", RMT_CPR[SOL Desc], "RM Name", RMT_CPR[RM Name], "DELIVERY_CHANNEL_ID", RMT_CPR[DELIVERY_CHANNEL_ID], "Source", "RMT_CPR" ) )Solved564Views0likes1CommentCalculated table with additional calculated column
Dear Group, I would like to create a table that will be based on Union as below: Ranking = Var _Plant1 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant1")) var _summary = ADDCOLUMNS(_Plant1,"Rank",RANKX(ALL(_Plant1),_Plant1[Sum of act],,DESC,Dense)) Var _Plant2 = CALCULATETABLE(SUMMARIZE('For Plants','For Plants'[Customer],'For Plants'[Plant abb],"Sum of act",sum('For Plants'[Actuals in LC])),FILTER('For Plants','For Plants'[Plant abb]="Plant2")) var _summary2 = ADDCOLUMNS(_Plant2,"Rank",RANKX(ALL(_Plant2),_Plant2[Sum of act],,DESC,Dense)) RETURN union(_summary,_summary2) Unfortunately, this doesn't work. It works if I do it step by step - first create a separate table per plant, then add a column with ranking and then create a separate table with UNION, but as I have 10 plants, I would like to avoid creation of 11 tables. The overall idea is to give rank to per customer per plant based on sum of actuals. Could you please advise how to do it all at one? Thank you in advance.Solved729Views0likes2CommentsFiltering a Multi-Select Slicer via AND instead of OR logic
In Power BI, slicer visuals work by restricting the rows of data accessible by visuals in the report. Multiselecting slicers unions the criteria by giving rows for all criteria. What is not possible with the default way Power BI filters things is to multiselect data with an intersection (using AND instead of OR logic) to only give rows that fit BOTH the selected criteria. For the report I am working on, I was asked to configure a way so that multi-selecting of our filter categories would filter data via this AND intersection opposed to the Power BI default. Other Solutions: Upon initial research (read: extensive googling!) I came across the following four articles which detail different approaches to achieving this. They all generally tackle the issue in a similar way – using measures to compare counts of selected items versus the count of rows matching these selected criteria. Slicer with AND condition in Power BI - RADACAD Apply AND Logic to Multiple Selection in DAX Slicer - SQLBI Changing “OR” to “AND” Logic for Power BI Slicers | by Orysya Stus | Seismic Innovation Labs | Medium Power BI: Implement AND/OR Selection | by ZhongTr0n | Towards Data Science However, due to the structure of the data I was working with and the specific needs of the report, none of these solutions exactly worked. The Data: For the sake of privacy I cannot share the actual data of the report although for developing the right method to replicate this ‘AND’ filter I can show a snippet of the structure of the data I am working with. Requirements: The specific solution I was tasked to create was a way to multi-select a slicer based on [Course] to filter visuals that all concerned the number of distinct Employees (based on unique key field [Email]). Without any of the AND logic implemented, the report looked like the following: You can see we have a count of the number of trainees broken down by different categories (hidden for the sake of privacy). When different courses are selected the data shown dynamically changes to include rows relating to either Course 1 OR Course 2 OR Course 3… and so on. Solution: To change this logic to instead give rows of one table (Employee Head Count) relating to multiple rows in another one (Course 1 AND Course 2 AND Course 3 …): DAX Measures! I have broken down my solution into two different parts corresponding to the two measures I have made. Pt 1. Trainees Count Without any AND logic, our original measure to count the number of employees who had completed training was the following: Trainees = DISTINCTCOUNT('Training Records'[Email]) To implement AND logic, we result in the following: numTraineesCompletedALLSelected = //the number of trainees who have selected all completed courses // count the number of criteria (courses) selected var selectedCourses = VALUES(Course[Course]) var numSelectedCourses = COUNTROWS(selectedCourses) //count number of selected courses completed per trainee var result = COUNTROWS( FILTER( GROUPBY( FILTER('Training Records', RELATED('Course'[Course]) in selectedCourses), 'Employee Head Count'[Email], "SelectedCoursesCompleted", COUNTX(CURRENTGROUP(), [Course]) ), [SelectedCoursesCompleted] >= numSelectedCourses) ) //if courses are being filtered: filter with AND condition //else count trainees normally return IF(ISFILTERED(Course[Course]), result, DISTINCTCOUNT('Training Records'[Email]) ) Let’s break this down, To start off we create two variables selectedCourses and numSelectedCourses which extract the courses we have selected via the slicer. Then we have the result variable – the main chunk of the logic. If we focus into the middle bit we have a GROUPBY function wrapping COUNTX with a filtered table. What this does is, from our training records table filtered to only have rows corresponding to the selected criteria, we count the number of courses (as per the COUNTX) grouped by each employee email. This gives us a table for each employee with a corresponding count of how many of the selected courses they have completed. We then further filter this resulting table to only give us employees who have completed at least the same number as the amount of selected courses. The final function is to COUNTROWS of this table to provide a number of how many employees have completed ALL of the selected courses. The final return part of the measure has an extra logic check to see if our criteria is being filtered at all. If it is, we return the result just calculated, if not, we default back to the usual way to count the number of employees. This new measure numtraineesCompeltedALLSelected (pending a name improvement lol) is what we use to replace the original Trainees measure. Pt 2. Count Courses Per Trainee While the previous measure sorts us out for visuals directly using the count of trainees (eg. Our bar graph, or card), what this does not account for is our table visualisations which have data rows corresponding to individual trainees from the Employee Head Count table. To solve this issue, I created a second measure, coursesCompletedPerTrainee = // count the number of criteria (courses) selected var selectedCourses = VALUES(Course[Course]) var numSelectedCourses = COUNTROWS(selectedCourses) // count the number of courses per trainee var coursesPerTrainee = COUNTX( FILTER('Training Records', RELATED(Course[Course]) in selectedCourses), 'Training Records'[Email]) var ANDCheck = IF(coursesPerTrainee >= numSelectedCourses, 1) //return non-blank if courses are not being filtered return IF(ISFILTERED(Course[Course]), ANDCheck, "Non-Blank") Looking very similar to our previous measure, our main difference is that this measure no longer uses a GROUPBY function. Instead, our return value is the number of courses (of the selected courses) completed per trainee (calculated with the COUNTX function). This is then used to filter our table by If we are not filtering at all we simply return a string “Non-Blank” which avoids errors when no criteria is selected. Summary When attempting this solution I found it necessary to have two measures to achieve two main things: 1) A total count of trainees who had completed selected courses (pt. 1) and 2) a measure by which to filter table visuals to only return relevant employee records (pt. 2). This is the main difference I found between my solution and the four previous articles I read in research. I found the difference in how the data I was using was structured compared to the sample data in solutions brought about this requirement as I was concerned with counting the records in one table (Training Records) grouped by the rows of another (Employee Head Count). I would be very interested in hearing of a way to optimize this and perhaps result in only one measure which can be used for the two purposes – the similarity in their code makes me believe this may be possible. For the time being however, I have developed this as the solution to meet the needs of the project as it results in the relevant output being provided for the report.Solved8.9KViews1like4CommentsHow to perform a merge based on shared column values?
Hi guys, I have 2 tables. One for invoiced orders and the other for currently orders yet to be shipped. I essentially want to merge these 2 tables as one based on the Order Reference Field as this field indicates that they went to the same Job Location. But I am unsure how best to do this whther in DAX or power query. I essentially want a new table so I can extract the total sale amounts for both invoiced and yet to be shipped orders. Any help would be appreciated .573Views0likes1CommentUnion two tables and no duplicate the rows when date updated
Hi All, I am new to PowerBi, I need your help please. I have two tables (TABLE1, TABLE2) that i want to union: TABLE 1 Client PartNo Titre TYPE Start Date projected End Date projected Real End Date Projet Name ClientXX AAAA Tool Prove NPI 09/03/2021 22/03/2021 21 mars 21 FA1 ClientXX AAAA Inspection NPI 09/05/2021 22/05/2021 FA1 ClientYY BBBB Methodes REV 09/04/2021 22/04/2021 FA1 TABLE 2 Client PartNo Titre TYPE Start Date projected End Date projected Real End Date Projet Name ClientXX AAAA Inspection NPI 09/05/2021 22/05/2021 23 mai 21 FA1 ClientYY BBBB Methodes REV 09/04/2021 22/04/2021 FA1 ClientXX CCCC Inspection NPI 10/04/2021 12/04/2021 FA2 The result I want after union (TABLE1; TABLE2) is like below: Client PartNo Titre TYPE Start Date projected End Date projected Real End Date Projet Name ClientXX AAAA Tool Prove NPI 09/03/2021 22/03/2021 21 mars 21 FA1 ClientXX AAAA Inspection NPI 09/05/2021 22/05/2021 23 mai 21 FA1 ClientYY BBBB Methodes REV 09/04/2021 22/04/2021 FA1 ClientXX CCCC Inspection NPI 10/04/2021 12/04/2021 FA2 But with DAX, i obtain the table below which keeps the row of TABLE1 and the row with date updated in column "Real End Date" of TABLE2 instead of keeping just row of TABLE2. Client PartNo Titre TYPE Start Date projected End Date projected Real End Date Projet Name ClientXX AAAA Tool Prove NPI 09/03/2021 22/03/2021 21 mars 21 FA1 ClientXX AAAA Inspection NPI 09/05/2021 22/05/2021 FA1 ClientXX AAAA Inspection NPI 09/05/2021 22/05/2021 23 mai 21 FA1 ClientYY BBBB Methodes REV 09/04/2021 22/04/2021 FA1 ClientXX CCCC Inspection NPI 10/04/2021 12/04/2021 FA2 Table = Var UnionTable=UNION(SELECTCOLUMNS('TABLE1';"Client";'TABLE1'[Client];"PartNo";"TABLE1"[PartNo];"Titre";'TABLE1'[Titre];"TYPE";'TABLE1'[TYPE];"Start Date projected";'TABLE1'[StartDate];"End Date projected";'TABLE1'[EndDate];"Real End Date";'TABLE1'[RealEndDate];"Projet Name";'TABLE1'[ProjName]);SELECTCOLUMNS('TABLE2';"Client";'TABLE2'[Client];"PartNo";"TABLE2"[PartNo];"Titre";'TABLE2'[Titre];"TYPE";'TABLE2'[TYPE];"Start Date projected";'TABLE2'[StartDate];"End Date projected";'TABLE2'[EndDate];"Real End Date";'TABLE2'[RealEndDate];"Projet Name";'TABLE2'[ProjName])) Return Groupby(UnionTable;[Client];[PartNo];[Titre];[TYPE];[Start Date projected];[End Date projected];[Real End Date];[Projet Name]) Anyone knows how to fix this problem ? Thanks!Solved6.6KViews0likes5CommentsIn a Distinct Union Calculatetable it appears that distinct is interfering with my filters
Hello, My situation is as follows: I'm trying to create a report that shows the number of distinct articles per different filter and different filter combination we have. So I have a large table with just the articles and it's surrounded by article property tables, which are connected via inactive connections. My attempt has been focused on unioning a bunch of filtered tables into 1 bigger table and then distinct count that. I have taken it in steps. The below code creates a table in the interface. UNION(CALCULATETABLE(Article,USERELATIONSHIP(Kleur[Kleur],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Maat[Maat],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dessin[Dessin],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Materiaal[Materiaal],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Merk[Merk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Warmteklasse[Warmteklasse],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal tijk'[Materiaal tijk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal vulling'[Materiaal vulling],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Breedte[Breedte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Lengte[Lengte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Neksteun[Neksteun],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Vulgewicht[Vulgewicht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoekhoogte[Hoekhoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoogte[Hoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Instopstrook[Instopstrook],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Stevigheid[Stevigheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Slaaphouding[Slaaphouding],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Eigenschappen[Eigenschappen],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Geslacht[Geslacht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Woonstijl[Woonstijl],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Draaddichtheid[Draaddichtheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Matrasdikte[Matrasdikte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Duurzaamheid[Duurzaamheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dekbedtype[Dekbedtype],'Unieke filters'[Unieke filters]))) This works and gives me 2million lines thanks to all the doubles. So I then wrapped a distinct around it: DISTINCT(UNION(CALCULATETABLE(Article,USERELATIONSHIP(Kleur[Kleur],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Maat[Maat],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dessin[Dessin],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Materiaal[Materiaal],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Merk[Merk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Warmteklasse[Warmteklasse],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal tijk'[Materiaal tijk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal vulling'[Materiaal vulling],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Breedte[Breedte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Lengte[Lengte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Neksteun[Neksteun],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Vulgewicht[Vulgewicht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoekhoogte[Hoekhoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoogte[Hoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Instopstrook[Instopstrook],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Stevigheid[Stevigheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Slaaphouding[Slaaphouding],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Eigenschappen[Eigenschappen],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Geslacht[Geslacht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Woonstijl[Woonstijl],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Draaddichtheid[Draaddichtheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Matrasdikte[Matrasdikte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Duurzaamheid[Duurzaamheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dekbedtype[Dekbedtype],'Unieke filters'[Unieke filters])))) This gives me a table of 64k distinct rows. But because it's loaded in a table it's not reactive to filters so I put that into a measure Below what I made: #Aanbod alle filters calctable = COUNTX(DISTINCT(UNION(CALCULATETABLE(Article,USERELATIONSHIP(Kleur[Kleur],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Maat[Maat],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dessin[Dessin],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Materiaal[Materiaal],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Merk[Merk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Warmteklasse[Warmteklasse],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal tijk'[Materiaal tijk],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP('Materiaal vulling'[Materiaal vulling],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Breedte[Breedte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Lengte[Lengte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Neksteun[Neksteun],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Vulgewicht[Vulgewicht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoekhoogte[Hoekhoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Hoogte[Hoogte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Instopstrook[Instopstrook],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Stevigheid[Stevigheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Slaaphouding[Slaaphouding],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Eigenschappen[Eigenschappen],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Geslacht[Geslacht],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Woonstijl[Woonstijl],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Draaddichtheid[Draaddichtheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Matrasdikte[Matrasdikte],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Duurzaamheid[Duurzaamheid],'Unieke filters'[Unieke filters])), CALCULATETABLE(Article,USERELATIONSHIP(Dekbedtype[Dekbedtype],'Unieke filters'[Unieke filters])))),[articlenumber])) <div>This gives the 64K results, but oddly doesn't change with when I use any of the connected filters.<div>However, when I remove the DISTINCT I get the 2 million lines but those 2 millions lines do change when I use the filters. So it seems like the distinct is somehow interfering with my filters. As such I tried several variants, including moving the table calculation into a variable and keeping the distinct out. That didn't do anything different though. Changing the DISTINCT into a GROUPBY function unfortunately also doesn't work. The moment I remove duplicate rows the measure stops responding to my filters. Does anyone know why Distinct is interfering with my filters or does anyone have a solution to my problem? Any help would be appreciated. edit: I edited this post just now due to a whole bunch of errors my browser was giving me. Ultimately it went through but was littered with HTML tags which I just removed.Solved1.8KViews0likes5CommentsCount smaller table rows compared to big table
I have 2 tables. Table 1 with 5000 variables. Table 2 with 2900 variables. Most of my charts are built from the 5000 variables however I have a card to count the variables but keep coming up with 5000. Is there a way only count Table 2 variables? I've tried RELATED and COUNTROWS to no avail923Views0likes2Comments