dax command
29 TopicsCreate a new table with columns from 2 separate tables using DAX
Hi Ive been trying to work out how to create a new table with 2 columns - column A from table 1 , column B from table 2. I want to create a custom table that just has the values I need, and I can modify any data as I need to without touching our main tables. I want to be able to drag any columns from the new table into a graph so I can build custom graphs without having measure or dimension incompatability. I tried using ALL but it has to be the same table. I'm frustrated as it just seems to be elusive to solve.....surely DAX isnt supposed to be this hard? If it was SQL i would have it done in 30 seconds Any help is much appreciated.Solved8.1KViews0likes7CommentsGet Sum of a measure in row context
Hello, I have a table of Assignments and a table Employees. I want to get Howmany days in the filter are within every assignment start and end date ... to get the employee booking hours within the selected month and year only For Example I selected Employee= Keerthi and month=March 2022 ... you can see that the column **Demand_Days_of_task_in_period will only count the days of this assignment that is within my date selection , so only march days are counted while feb and may are not. The measure formula ** Demand_Days_of_task_in_period = CALCULATE(COUNTROWS('Date'),FILTER('Date','Date'[Date]>=MIN(Assignments[AssignmentStartDate])&&'Date'[Date]<=MIN(Assignments[AssignmentFinishDate]))) The requirement: I want to access this measure out of row context, meaning that when I add it to a card it will sum all the rows values (6+1+1+1+2+2+2+2+1)= 18 .. but as you can see the card on the top right which is with the same measure is giving me blank, it will only give me a value when I select a specific row ... I searched for it but found most ways are through creating a calculated column, while the measure here will depend on the user selection of the date Thanks for helpSolved4.7KViews0likes2CommentsList items that match all the selected values
Hello Community, I am trying to get the list of Items based on the year selection i.e. when I select "2022 and 2021" in the year slicer. Then I should get the Item that are names that are in both (2022 and 2021 years) i.e. Apple and Cucumber rows should get a value "Y", else "N". Year .Slicer = 2022 and 2021 Cat Item Year unit Sales Output A Apple 2022 100 200 Y A Apple 2021 200 400 Y A Apple 2020 500 1000 N A Papaya 2021 100 400 N A Papaya 2020 40 160 N V Cucumber 2022 150 500 Y V Cucumber 2021 250 800 Y If I select 2020, 2021,2022 years then I should have only Apple (because only Apple is present in all 3 years) Cat Item Year Unit Sales Output A Apple 2022 100 200 Y A Apple 2021 200 400 Y A Apple 2020 500 1000 Y A Papaya 2021 100 400 N A Papaya 2020 40 160 N V Cucumber 2022 150 500 N V Cucumber 2021 250 800 N Please can anyone help me in achiving this measure. Thanks, AnthonySolved4KViews0likes5CommentsDAX Will Not Reference Columns
Hi All, I have two tables: - Table A: contains project information such as ID, start date, end date, etc. These are all columns. - Table B: contains financial information such as Total Actuals, Budget, etc. These are all measures based on another table. I need to create a measure in Table A that references the Start Date column, as well as two of the financial measures from Table B. However, when trying to create the measure, the "IF" statement will not reference the Start Date column from Table A. Do you know why this is? I am trying to do something like... IF(And(Year(Project Start Date) = 2021, Total Forecast - Total Actuals > 0), Total Forecast - Total Actuals, 0) Any thoughts or advice would be much appreciated!3.7KViews0likes6CommentsSum multiple columns values based on filter
Hi, Here's the example of the data tables I have SolutionMap: Performance pivot table: |Solutionid(distinct) | Workload |Partner id | 1 | 2 | 1 | A |1 | 250 | 180 ..... . | 2 | A |2 | 150 | 100 | 3 | B |3 | 100 | 80 | 4 | C .... The Performance pivot table has partner id and the revenue for each Solutionid, I need some help to create a measure table that will sum the revenue base on the SolutionID I picked from the list filter , For example, if I select Solution ID 1, it should show: |Partner id | Total_revenue |1 | 250 |2 | 150 |3 | 100 if I selected Solution ID 1,2, it should show: |Partner id | Total_revenue |1 | 430 |2 | 250 |3 | 180 How should I do it? Thank you .Solved3.6KViews0likes3CommentsHow to make a graph understand that the week number is next year (to make the date sort right)?
Hi, I have this data: And I have made this graph - which shows completed sales and expected future sales. This works great for when I use the "Date" field, but I want it on week level, and when I do that it looks strange (see picture below), because Power BI doesn't understand that week 1 is next year, and hence is after week 52. Is there a way to make it understand that week 1 is next year? And hence that the graph looks more similar to the one with "Date"? Thanks in advance, highly appreciate it 🙂Solved3.4KViews0likes11CommentsSelect Specific Date and Previous 6 Months Data
I am trying to create a line chart that returns the previous year December data and the last 6 months data for current year. I have managed to create the dax measure for last 6 months as below: nMth = VAR MAX_DATE = MAX('CALENDAR'[DATE]) VAR PREV_DATE = DATESINPERIOD('CALENDAR II'[DATE],MAX_DATE,-6,MONTH) VAR RESULT = CALCULATE(SUM(TABLE[SALES]), REMOVEFILTERS('CALENDAR'), KEEPFILTERS(PREV_DATE), USERELATIONSHIP('CALENDAR'[DATE],'CALENDAR II'[DATE])) RETURN RESULT Now I am stuck on how to include the December data for previous year. The mechanic of the visualisation is user will click on Date Slicer for single specific date, i.e., user select 30/11/2022, then it will show a line chart for 31/12/2021, 30/6/2022, 31/7/2022, 31/8/2022, 30/9/2022, 31/10/2022 and 30/11/2022. Any help is greatly appreciated! DATE SALES 31/01/2021 453 31/01/2021 605 31/01/2021 867 28/02/2021 724 28/02/2021 490 28/02/2021 275 31/03/2021 875 31/03/2021 338 31/03/2021 458 30/04/2021 269 30/04/2021 560 30/04/2021 623 31/05/2021 753 31/05/2021 492 31/05/2021 327 30/06/2021 377 30/06/2021 654 30/06/2021 669 31/07/2021 636 31/07/2021 702 31/07/2021 208 31/08/2021 405 31/08/2021 449 31/08/2021 495 30/09/2021 386 30/09/2021 822 30/09/2021 384 31/10/2021 486 31/10/2021 326 31/10/2021 210 30/11/2021 458 30/11/2021 766 30/11/2021 460 31/12/2021 271 31/12/2021 622 31/12/2021 208 31/01/2022 540 31/01/2022 455 31/01/2022 325 28/02/2022 650 28/02/2022 208 28/02/2022 226 31/03/2022 260 31/03/2022 579 31/03/2022 550 30/04/2022 578 30/04/2022 480 30/04/2022 667 31/05/2022 301 31/05/2022 336 31/05/2022 427 30/06/2022 676 30/06/2022 835 30/06/2022 461 31/07/2022 351 31/07/2022 230 31/07/2022 465 31/08/2022 392 31/08/2022 375 31/08/2022 425 30/09/2022 346 30/09/2022 612 30/09/2022 268 31/10/2022 420 31/10/2022 377 31/10/2022 488 30/11/2022 407 30/11/2022 812 30/11/2022 363Solved2.8KViews0likes5CommentsRankX() function not available when creating a new calculated column with variable
Hi Daer Community, I am trying to rank a column based on its count in anothercolumn. But the rankx() function is not available there. Top5 cases & Others = Var RankProductsByCaseCount = rankx() - it says "rankx() is not a function" . Any tips why? Thank you!Solved2KViews0likes2CommentsDAX code to aggregate values of time stamps in one fact table based on time window in another table
Hi, Being a newbie struck in code for using two fact tables. Have two fact tables and one dim table linked with common column Meter_ID. Objective - Aggregate values against each time stamp of one fact table based on the date and time window(Between start time and end time) in another fact table for each Meter_ID. "tm_periodflow_instants" table has Time stamp and Dates separately along with the values which need to be aggregated based on "Date" ,"Start Time" ,"End Time" of another fact table "Prod_data_from_software". I could not complete the DAX formula for the measure which i started as below as related was not bringing the other fact table columns for filtering. Energy Values = CALCULATE( SUMX(tm_periodflow_instants,tm_periodflow_instants[Value]), FILTER(ALL(tm_periodflow_instants),tm_periodflow_instants[Time] < RELATED(P ))) Deeply appreciate your support to complete the code (For some reasons could not upload the data model images in the forum after repeated attempts)Solved1.6KViews0likes8CommentsAverage value based on two columns in another table
Hello PowerBI community I have two tables PreviousOrders and FutureOrders. PreviousOrder Facility Processing Time OrderType A 13 Express A 15 Normal B 19 Express C 10 Normal A 11 Express B 15 Express B 13 Express C 14 Normal FutureOrders. Facility OrderType ExpectedTime A Express =averageif(A and Express in First table) B Express C Express C Normal A Express A Normal B Express C Normal I would like the ExpetedTime in the “FutureOrders” table to be the "Processing Time" for that facility and order type based on the data in PreviousOrder. Is there an easy way to do this in DAX? Thank youSolved1.4KViews0likes3Comments