calculated column
51 TopicsCalculated Column Index that Restarts from 1 Based on Values in Another Column
I am trying to create a DAX calculated column formula that sorts the rows in order based on the "CreatedDate" column and then indexes the rows starting from 1. I want to restart the Index every time the "Net Promoter System" column does not equal "Promoter". The below formula does not restart the index from 1. How can I adjust it? Index = VAR CurrentDate = NPS[CreatedDate] VAR CurrentRowNumber = NPS[Survey Name] VAR IsPromoter = NPS[Net Promoter System] = "Promoter" RETURN IF( IsPromoter, COUNTROWS( FILTER( NPS, NPS[CreatedDate] <= CurrentDate && NPS[Survey Name] <= CurrentRowNumber && NPS[Net Promoter System] = "Promoter" ) ), 0 )Solved1KViews0likes4CommentsNeed help on Sequence number in same column and Horizontal records in same row
Hi All, Please find the below screenshot of sample data, need help on the "Horizontal records" in a same row and "Sequence number" for different Insureds numbers. Sample Data: Below are the requirements need to work on the DAX calculated column: "Upload ID", "Policyholder Name" and "InsuredS". Please help. Requirement: 1. Under "UploadId" and "Policyholder Name" In case multiple values are present for a single Application Number, list all items need to display horizontally, separated by a space. Maximum of 20 characters allowed, in case this limit will be exceeded display "..." at the end 2. For "Insured Branch Number" new calculated column display a sequence of numbers starting from "1" in case multiple insureds are present within the policy Expected OUTPUT: Here is the OUTPUT need to display in Power BI with the help of sample data. Please help. Sample Data Reocrds: Here is the sample records can work for this expected OUTPUT. Policy Product Type Application Number Image Upload Date and Time Upload ID Policyholder Client ID Policyholder Name InsuredS 9000123 GH 30330330311 2024/7/03 13:00:02 bheemvi 7185244885 bheemvi 8541224151 1236121 RT 77879174306 2024/7/03 13:00:02 surfati 5535470245 surfati 7563424173 3954848 MM 40760081519 2024/7/03 13:29:30 kudou 7128024728 kudou 5535470245 3954848 MM 40760081519 2024/7/03 13:29:30 raju 7128024728 raju 9641540351 3954848 MM 40760081519 2024/7/03 13:29:30 venky 7128024728 venky 8541224151 6864730 CN 40510010297 2024/7/03 14:02:99 suresh 8541224151 suresh 7563424173 9000520 BO 40760081311 2024/7/03 14:02:99 naresh 7563424173 naresh 5535470245 1236121 RT 77879174306 2024/7/03 15:00:02 gopal 5535470245 surfati 9873424173Solved699Views0likes2CommentsDAX Calculated Column in the Table View
I want to create a calculated column in the Table View in Power BI. I want the calculated column to group the "Company" column based on how many unique values occur in the "Lender" column. For example, the below table has 3 companies, and each company has two records of their lenders. Company1 has two different lenders, so I want the calculated column to list "2" for both of its records. Company2 and Company3 have the same lender listed twice, so I want the calculated column to list "1" for both of its records. Company, Lender, Count of Lenders Company1, Private, 2 Company1, Public, 2 Company2, Private, 1 Company2, Private, 1 Company3, Public, 1 Company3, Public, 1 I know this is possible to achieve with Power Query, but can I achieve it in the Table View once the data is loaded out?Solved641Views0likes2CommentsGroup By Calculated Column
How would I create the "Is Loyal v2" column in the Table View using DAX based on the first two columns? I want the outcome to equal "No" for all rows if there is a row that equals "No" for the ID in the first column. I know I can achieve this with Power Query, but wondering if it's possible in the table view. ID Is Loyal Is Loyal v2 1 Yes No 1 Yes No 1 Yes No 1 No No 1 Yes No 2 Yes No 2 No No 2 Yes No 2 Yes No 2 Yes No 3 Yes Yes 3 Yes Yes 3 Yes Yes 3 Yes Yes 3 Yes YesSolved2KViews0likes4CommentsCalculated column based on lookup table returns empty
I'm trying to calculate for every contract in a dataset with contracts whether or not a specific budget applies or not. This budget I need to detract from my overall figure, so I need to have it on a contract to contract basis. I have queried a simple lookup table where I have all the relevant filter columns (product, model, duration, ...) and how high the specific budget is for these conditions. I want to calculate a column with for each contract the applied budget. I'll enclose my current DAX lines for calculating this column, and it does not give me syntax errors, but the resulting column is completely empty. My main table is 'Retail+Fleet' and 'Special actions' is the small lookup table with the conditions and the [Budget action] column with the size of the specific budget. I've also included a simplified version of the two tables, where the green column indicates what I expected the resulting column to look like, but that at the moment is completely empty (not even showing null or 0). Does anyone have an idea where I'm making a mistake? SpecialAction = /* Use if lookup doesn't bring anything back - this is for easiness just set to 0 */ VAR DefaultAction = 0 /* Product Class (to filter on PL) */ VAR ProductPL = 'Retail+Fleet'[Product Class] /* New Car */ VAR NewCar = 'Retail+Fleet'[New/Used car] /* Duration */ VAR Duration = 'Retail+Fleet'[Contract duration] /* Calculation Date */ VAR CalculationDate = 'Retail+Fleet'[Calculation date] /* CMIS Brand */ VAR CMISBrand = 'Retail+Fleet'[CMIS Brand] /* Model */ VAR CarModel = 'Retail+Fleet'[Model] /** Filter all contracts to see whether they fall within the specific conditions, and check whether the creation date falls within the to and from date range. The BLANK() value ensures that for the lines where the Car Model or the Duration is not filled in, the filter option is not stopped. **/ RETURN CALCULATE(FIRSTNONBLANK('Special actions'[Budget action],1), FILTER( 'Special actions', 'Special actions'[Product Class] = ProductPL && CalculationDate >= 'Special actions'[Date From] && CalculationDate <= 'Special actions'[Date To] && 'Special actions'[VN - VO] = NewCar && ('Special actions'[Duration] <= Duration || 'Special actions'[Duration] = BLANK()) && 'Special actions'[CMIS Brand] = CMISBrand && ('Special actions'[Model] = CarModel || 'Special actions'[Model] = BLANK()) )) Lookup Table ('Special actions') Product Class CMIS Brand Model Duration Date From Date To VN - VO Budget action PL Brand 1 24 1/1/24 31/1/24 VN 800 PL Brand 1 36 1/1/24 31/1/24 VN 1000 PL Brand 1 48 1/1/24 31/1/24 VN 1000 PL Brand 1 Model 1 48 1/1/24 31/1/24 VN 1500 PL Brand 2 Model 2 48 1/1/24 31/1/24 VN 600 PL Brand 3 Model 3 48 1/1/24 31/1/24 VN 600 Main Table ('Retail+Fleet') Product Class CMIS Brand Model Contract Duration Calculation date ... New/Used car SpecialAction AC Brand 1 Model 6 36 20/12/23 ... VN CC Brand 1 Model 40 24 30/12/23 ... VN OL Brand 1 Model 1 60 3/1/24 ... VN PL Brand 2 Model 2 48 5/1/24 ... VN 600 PL Brand 3 Model 4 48 12/1/24 ... VN PL Brand 1 Model 2 60 19/1/24 ... VO PL Brand 1 Model 1 24 30/1/24 ... VN 1500 PL Brand 1 Model 3 36 2/2/24 ... VN PL Brand 2 Model 3 30 18/2/24 ... VO PL Brand 3 Model 2 72 1/3/24 ... VNSolved657Views0likes2CommentsSum the averages of multiple categories
Hello! I'm struggling to come up with a DAX formula (measure or calculated column) that will calculate the Sum of the average score for each evaluation area. In my scenario, there are 3 people giving scores to 2 different companies based on 3 different evaluation areas (e.g., John scores Company X and Company Y based on criteria 1, 2 and 3). I want to calculate the average score of each evaluation area by company, and then sum those averages (so the sum of averages for each company). I'm hoping to make the formula dynamic so that if certain scorers or eval areas are filtered out, the end result would change accordingly. Thank you very much! The end result will look like the last column in the table below. The calculations should look like this: Company X: Avg score of eval area 1 = 2.83 Avg score of Eval area 2 = 2.50 Avg score of Eval area 3 = 3.50 Sum of all eval areas = 8.83 Company Y: Avg score of eval area 1 = 3.33 Avg score of Eval area 2 = 2.67 Avg score of Eval area 3 = 3.0 Sum of all eval areas = 9.0 Evaluation Area Scorer Score Company Calculated column/measure desired result Eval area 1 Andy 3 Company X 8.83 Eval area 1 John 4 Company X 8.83 Eval area 1 Beth 1 Company X 8.83 Eval area 2 Andy 2 Company X 8.83 Eval area 2 John 3 Company X 8.83 Eval area 2 Beth 1 Company X 8.83 Eval area 3 Andy 5 Company X 8.83 Eval area 3 John 1 Company X 8.83 Eval area 3 Beth 2 Company X 8.83 Eval area 1 Andy 5 Company Y 9.0 Eval area 1 John 1 Company Y 9.0 Eval area 1 Beth 3 Company Y 9.0 Eval area 2 Andy 2 Company Y 9.0 Eval area 2 John 4 Company Y 9.0 Eval area 2 Beth 5 Company Y 9.0 Eval area 3 Andy 3 Company Y 9.0 Eval area 3 John 2 Company Y 9.0 Eval area 3 Beth 1 Company Y 9.0Solved1.2KViews0likes2CommentsPower Pivot - Calculated Column - How to find the 2nd minimum value based on other column groups
I'm having trouble creating a Calculate Column in Power Pivot. I have a table that shows bid results from multiple suppliers for multiple items and divisions. Through research I've been able to figure out the DAX formula for the minimum bid (by Division, by Item). =CALCULATE(MIN(Table1[Bid Cost]),ALLEXCEPT(Table1,Table1[WAREHOUSE / DIVISION],Table1[ITEM NAME])) I was also able to figure out the percent difference based on the lowest bid. =(Table1[Bid Cost]-CALCULATE(MIN(Table1[Bid Cost]),ALLEXCEPT(Table1,Table1[WAREHOUSE / DIVISION],Table1[ITEM NAME])))/Table1[Bid Cost] I'm now being asked if I can do the same for the 2nd lowest bid (by Division, by Item) to place in a Pivot Table for when we make negotiation calls. I've been looking for a couple days through the forum and google, and cannot seem to find an answer for the 2nd lowest value Calculated Column. In Excel, the formula would be: 2nd Lowest Bid =SMALL($D$5:$D$13,2) % From 2nd Lowest Bid =(D5-SMALL($D$5:$D$13,2))/D5 Here is my data sample. I apologize, I'm trying to figure out how to attached the sample data file, but my OneDrive and GooglDrive is blocked by IT security.1.6KViews0likes5CommentsDisplay last 5 weeks based on Selected Date
Hi everyone, I am pretty new to Power Bi and DAX, so I'd appreciate any pointers here. Here is my problem: Based on the selected date, I need to display data in a matrix table on the selected date and 5 weeks ago. Unfortunately, this is a problem from work, so I'm unable to share the actual data but here is an example with some dummy data: My selected date is 9/15/23. This is the data that should be displayed: If I select the date to be 9/8/23, this is how the new selected data should be displayed: In essence, selecting 9/8/23 results in the 9/8/23 totals to be added to the 9/15/23 totals. The remaining data results would display weekly from 8/11/23 up to 9/1/23. This type of functionality should exist for any selected date I choose. Here is a dummy view of what my actual table looks like. I also have a independent date table that is the distinct updated date from my actual table. Updated Date Days Open Status Count Date Difference (Today - Updated Date) 9/15/23 0 to 9 A 3 6 9/15/23 10 to 19 A 13 6 9/15/23 0 to 9 B 5 6 9/15/23 10 to 19 B 10 6 9/8/23 0 to 9 A 5 13 9/8/23 10 to 19 A 3 13 9/8/23 0 to 9 B 6 13 9/8/23 10 to 19 B 5 13 Currently, I have a display similar to the 1st picture, but this is without selecting any dates. I calculated a date difference between the updated date and Today's date and used those numbers as a filter to help display something similar to the first picture. Now if I try to select a date using a filter, it will only display that selected date's data, which isn't what I want. I tried to utilize the independent date table in the filter but obviously was running into issues because there's no actual relationship between my actual table and the date table. And even if I'm able to figure out this issue, I'm not even sure how I can visualize the second picture. Is this type of visualization even possible in Power BI? I just don't know where to begin 😞740Views0likes1CommentCalculated Column not being executed
Hello! I have a table called Progression1 with a calculated column generated with the following code: Rate= CALCULATE(sum(Masterfile1[Awarded]),Masterfile1[STATUS]="GRD",Progression1[Term])/42.34) It works perfectly, and it creates a column with the values that I need. However, when I try to replicate in my second table called Progression2, like this: Rate= CALCULATE(sum(Masterfile2[Awarded]),Masterfile2[STATUS]="GRD",Progression2[Term])/42.34) Nothing happens. I don't get the usual loading screen and seems like the code is not being executed at all. If I click anything afterwards the calculated column goes back to the default Column = Anyone has any idea why does this happens? Is it something on my end? Thank you!692Views0likes3CommentsExclude whole group if value is not found
Hi My problem is similar to this one, but excluding values when not found. I have a "Store" column and a "Product" column and i want to show all products from the store only when it has the product "Paint", if a store doesn't have "Paint" in one of its rows i need a filter that excludes all of the store in all pages of my model. If this is my Data: ID Store Product 1 1 Chips 2 1 Paint 3 2 Paint 4 3 Soda 5 3 Chips I want my model to work only with this rows (Store 1 and 2): ID Store Product 1 1 Chips 2 1 Paint 3 2 Paint Thanks a lot!Solved1.3KViews0likes3Comments