conditional measures
4 TopicsColumn or measure Conditionals
Hi, I have a column with this conditions: ConditionalColumn= VAR userID= [UserID] VAR IDduplicated = CALCULATE(COUNTROWS(table), ALLEXCEPT(table, table[UserID])) > 1 VAR shopIDduplicated = IF( IDduplicated, CALCULATE( COUNTROWS(table), ALLEXCEPT(table, table[UserID]), table[shopID] = EARLIER(table[shopID]) ) > 1, FALSE() ) RETURN IF( IDduplicated && shopIDduplicated, "Yes", "No" ) I would rather, if UserID is duplicated, for each duplicated UserID, take their shopID. If the shopID is duplicated, put "Yes"; otherwise, put "No". Below, I show you what this conditional column is doing and what i want: Example: I have 3 duplicated UserIDs, but 2 of them have the same shopID. I want the conditional column to show "Yes", only for those 2 lines; for the oder UserID, it becames "No". What's wrong is in lines where UserID is "22" (lines number 2-3-4). It has "Yes" for all 3, but first shopID isn't equal to others, so it should be "No", "Yes", "Yes". Conditional//shopID//categoryID//userID//YearStart;MonthStart;DayStart//YearFinish;MonthFinish;DayFinish Column No 111 1 11 2023 November 10 2023 October 9 Yes 222 2 22 2023 February 28 2023 January 16 Yes 333 3 22 2023 October 6 2023 October 1 Yes 333 3 22 2023 October 16 2023 October 16 No 444 4 33 2023 June 1 2023 May 23 Yes 555 5 44 2023 November 3 Yes 555 5 44 2023 January 19 2023 January 10 Yes 555 6 44 2023 July 28 2023 February 13 Yes 777 5 44 2023 November 2 2023 August 14 Yes 666 9 55 2023 May 31 2023 April 17 Yes 666 9 55 2023 July 21 2023 June 1 PS: The next level would be: once you have those "Yes" values, filter them for the same UserID, shopID, and check if they have the same categoryID. If they do, this would be the real "Yes"; the others would be "No". In that case, taking the table example, for the UserId "44", the correct sequence would be: Yes-Yes-No-No. PS2: The final level would involve, once you have level 2, comparing the start date with the end date for lines that meet the previous criteria. If datediff is <=5 days, it should be "Yes"; otherwise, "No". Next step would be to do the same for the end date, comparing it with other lines' start dates. Before this, thake the next line and do the same... However, it's more important to have levels 1 first and 2 correct, not this level. Any help is appreciated. Thanks!689Views0likes3CommentsMeasures based on two tables correlated to filter
Hi community, I have one dim table and two fact tables. Dim table has country_code and country_name columns. First fact table has country_code column and orders column. Second fact table has tasks_names column (task to process orders for a country) where first letters are country codes and time spend on task column. I would like to write a measure for speed so sum of orders for a country divided by time spent on task for a country. How to do that so it would be dynamic? I now I can write a measure for every task and country but is there a way to write one measure because I would like to then put it on chart and be able to use slicer with countries and when picking a country to see speed for picked one :). Sorry for no file I'm on the phone but maybe someone could give me some ideas as I need them badly haha. I will also come back with file if needed. Thanks, community is great!!!!Solved795Views0likes4CommentsCalculate % of hours worked base two different working schedual using a calculated table/measure
Hello Power BI community, I will need some help for this task. I have two working schedule, the first one include working on saturday for 8 hours whereas the second one only works for 5 hours on that day. I created a calculated column to have a full calendar (removing the sundays) and specify the number of hours per day : The total number of hours worked and the names are on a non calculated table. The objective is to calculate depending on the person the % of hours worked (filtred by the number of days) In short : I want to devide "number of hours worked" by "sum work hour normal/exception" depending on the person. Thank you for your time and help!669Views0likes2CommentsConditional reference to measures/options
Hello friends, Relatively new to Power BI, business requirement relates to below sample scenario: Have 2 measures: Coverage = Count(Deals), Product = distinctCount(Deals) Based on the data model, create a new field/measure?? in table/matrix with the header name Deals using the logic: If Continent ="Asia" THEN [Coverage] ELSE IF Continent ="America" THEN [Product]. At run time - Using Dax in Table or Matrix (Not Power Query), how do I achieve above with or without the use of measures that have been created? Note: The field Continent should not be a part of the table/matrix(UI) but is a part of the star schema in the data model. Thanks, SidSolved1.1KViews0likes4Comments