'need help'
14 TopicsTop10 + Others with duplicate values
Hi, In the past I was able to create a calculated column that made Top10+Others working Sales Top10+Others = VAR RankProductbySales = RANKX(All('Product'), [Sum Sales Quantity] ,,DESC) RETURN IF (RankProductbySales<=10,'Product'[productname], "Others") That worked. But it worked because productname was unique in the table. I recreated this in the attached pbix. Table Product_V1 connected to Sales and as you can see in the visual with column 'Product_V1' it gives the right result. But I created a second version, table Product_V1. This reflects my current challenge, wehereby this Product_v2 is just very simplified. The issue is that I now want to Rank by owner. But an owner can have multiple products. In other words, the owner is not unique in the product table. How do I do this? If you look at the left visual with column 'owner' it is rnked on product. But I want it to be ranked as shown in the left visual with column 'owner'. Whereby it contains three lines: Rob with 1125, John with 700 and Others with 1225. https://www.dropbox.com/scl/fi/acmlmt4cvgmrd9ckj1en8/TopN-Others_2.pbix?rlkey=n5unb6h8hfq6uh8y1ulnbekp3&st=qrbchmbt&dl=0 https://www.dropbox.com/scl/fi/05u3t9mwp73l9op2ys7gi/TopN-Others_2.xlsx?rlkey=04cjme3h457abgyjfpw2omy5q&st=zzlz25so&dl=0 Hope someone can help. lbendlin bhanu_gautam Regards RonSolved684Views0likes2CommentsShow last N months based on FiscalYearMonth slicer selection without calendar/date table
My requirement Ex-1 When the user select a value say 202501 from slicer "FiscalYearPeriodCd" which is a text data type. The table below should display last 13 months . Ie from 202401 to 202501. ---Last 13 months Ex-2 When the user selects "202411" , the table below should display SalesUSD from 202311 to 202411 .---Last 13 months. .Unfortunately i have a calendar table but the calendar table and fact table are related using someother key and not a datekey as per the business requirement and hence i cannot change it.Also in my date table , i have the date repeated twice.One is for US and another for Non US due to fiscal calculation.Hence i cannot use datesinperiod , dateadd or other date related functions.Hence the only option is to use FiscalYearPeriodCd. Raw data below SalesUSD FiscalYearPeriodCd 534132759.5 202201 1557801979 202202 695221259.1 202203 813135024.7 202204 832097591.8 202205 755491149.2 202206 848978369.6 202207 831567295.5 202208 907314200.6 202209 822103615.4 202210 674213875.8 202211 -2879970782 202212 859510773.8 202301 908174754.8 202302 856401757.6 202303 864263784 202304 880142006.9 202305 861088774.2 202306 -2353615032 202307 968984985.4 202308 -1857687494 202309 868514132.3 202310 -66961618.2 202311 1317854317 202312 1060522633 202401 1011795775 202402 829441979.7 202403 1100402094 202404 1064195484 202405 1138271467 202406 1898901.5 202407 754629775 202408 130722055.9 202409 1437834704 202410 912161100.4 202411 167628959.9 202412 486353211.6 202501 98759203.23 202502 Expected output for Ex 1 slicerselection = 202501 MgmtRateUSD FiscalYearPeriodCd 1060522633 202401 1011795775 202402 829441979.7 202403 1100402094 202404 1064195484 202405 1138271467 202406 1898901.5 202407 754629775 202408 130722055.9 202409 1437834704 202410 912161100.4 202411 167628959.9 202412 486353211.6 202501 expected output for ex 2 - slicerselection = 202411 MgmtRateUSD FiscalYearPeriodCd -66961618.2 202311 1317854317 202312 1060522633 202401 1011795775 202402 829441979.7 202403 1100402094 202404 1064195484 202405 1138271467 202406 1898901.5 202407 754629775 202408 130722055.9 202409 1437834704 202410 912161100.4 202411 Thank you so much in advance.Solved744Views0likes3CommentsSell Through DAX measure
Hello everyone! I need some help with DAX. Basically, I have to calculate SELL_THROUGH of the stores (CD_LOJA_SAP) and skus (CD_EAN) where [SELLOUT] AND [POSICAO_ESTOQUE] are not blank ou zero. Here is an example, using CD_LOJA_SAP: 1. How it is at the moment: 2. How I want it to be: As you can see, the measure works correctly for the rows in the table. However, the issue lies with the "Total" row. I need it to exclude stores 1 and 2. My model: DAX measures: SELL_THROUGH = VAR MaxData = [MAX_DT_ESTOQUE] VAR Estoque = [POSICAO_ESTOQUE] VAR Sellout = [SELLOUT] VAR Estoque_Sellout = [POSICAO_ESTOQUE_SELLOUT] VAR ST = SWITCH( TRUE(), ISBLANK(Sellout) || ISBLANK(Estoque), BLANK(), DIVIDE(Sellout, Estoque_Sellout) > 1, 1, DIVIDE(Sellout, Estoque_Sellout) ) RETURN ST MAX_DT_ESTOQUE = VAR MaxData = CALCULATE(MAX(fEstoque[DT_ESTOQUE]), ALL(fEstoque),fEstoque[CHAVE_COLECAO_COMERCIAL] = SELECTEDVALUE('Coleções'[DS_COLECAO])) RETURN MaxData POSICAO_ESTOQUE = VAR MaxData = [MAX_DT_ESTOQUE] VAR PosicaoEstoque = CALCULATE( SUM(fEstoque[QT_ESTOQUE]), fEstoque[DT_ESTOQUE] = MaxData ) RETURN PosicaoEstoque SELLOUT = VAR MaxData = [MAX_DT_ESTOQUE] RETURN CALCULATE( SUM(fSales[VOLUME]), fSales[DT_PEDIDO] <= MaxData ) POSICAO_ESTOQUE_SELLOUT = [SELLOUT] + [POSICAO_ESTOQUE] Could anyone please help me? Thank you so much!Solved1.3KViews0likes1CommentSELECTEDVALUE inside table constructor
Hi, I have the following measure inside a filter context where the only selected value for column 'ParameterTable'[ItmNam] is "A" (in fact it's a parameter table): CALCULATE( COUNTROWS('Table'), 'Table'[ItemName] IN {SELECTEDVALUE('ParameterTable'[ItmNam])} ) But the measure is not counting the rows in table 'Table' where ItemName = "A". If I change the measure as follows, it works fine: CALCULATE( COUNTROWS('Table'), 'Table'[ItemName] IN {"A"} ) Why SELECTEDVALUE doesn't works inside a table constreuctor? Where is this limitation written or explained? Note: I don't need a workaround (variables can solve it), I need the conseptual explanation or documentation plese. Thank you! marcorussoSolved1.8KViews0likes5CommentsDoes filter (All('TableName')) remove duplicates?
I am new to Power BI and am learning the basics and am having a tough time figuring out the following: I have a Product Table with columns for product name, brand, and color. I have a matrix showing Brand and a measure "RedProductscount" The page has a slicer on color. The measure uses All ( ) command I understand why the count is always the total count of all Red products no matter what color is selected in the slicer when the code in the measure is : RedProductscount = countrows(filter(ALL('Product'),'Product'[Color]="Red")) It ignores the color selected in the slicer and counts how many red products are. But I do not understand why it shows a count of 1 if I change the measure to apply ALL to the color column like so: RedProductscount = countrows(filter(ALL('Product'[color]),'Product'[Color]="Red")) The only thing I could think of is that 1 represents the count of "Red"s in a list of unique colors. But is it really that? Questions: If it *is* the count of reds in the list of unique colors, what makes All to remove duplicates in the color column and turn it into a unique color list? Does it mean that Filter(All('TableName')) will ignore duplicates and do we have to be careful when we apply ALL() command on a table? If it is not the count of reds in the unique list of colors, then what is 1?Solved623Views0likes2CommentsVlookup, multiple filters
I have been trying to replicate something I had been doing very manually on Excel, involving a VLOOKUP then counting non blanks in the result. I have attached the sample data for that purpose, and this is the working to replicate it in Power BI. Working Column = var _order = 'Table2_2'[Original Sales Order] Return MAXX(FILTER('Table2_2','Table2_2'[Sales Order No]=_order),'Table2_2'[Sales Order No]) New Measure : NCP on NCP = DISTINCTCOUNT('Table2_2'[Working Column]) Sample Data But then I realised, the sample data has already been filtered out once. How do I add in another filter so I only need to use one working column (If possible)? Basically, in the return part of the working column, as well as looking up the 'original order number' in earlier lines to see if it has already appeared, it also needs to look up to see if order type of the earlier order number matches one of two specific types. I tried using lookupvalue to create a second working column (to look up the first working column result to see if it is the correct sales order type) and the result was just a mess, because each sales order can appear multiple times (although in the real original data there is another identifier column to show what the line number is in each sales order number). I have added the sales order type in the sample data column, have made it all one type (because that is correct for this data) but what if there are other sales order types? And I don't want those included in the maxx filter? I guess to summarise, how do i put in a second filter into the maxx function so that not only is it looking for the var to have appeared earlier in a different column, it also looks to make sure the sales order type is correct? Hope this explanation is clear enough and thanks for the help.Solved681Views2likes2Commentscalculate % Product codes not sold in all territories?
Expected output Sample data: QUANTITYORDERED 30 34 41 45 49 36 29 48 22 PRICEPERUNIT 95.7 81.35 94.74 83.26 100 96.66 86.13 100 98.57 ORDERLINENUMBER 2 5 2 6 14 1 9 1 2 SALES 2871 2765.9 3884.34 3746.7 5205.27 3479.76 2497.77 5512.32 2168.54 ORDERDATE 12/31/2019 0:00 3/12/2020 0:00 5/6/2020 0:00 6/30/2020 0:00 8/15/2020 0:00 9/2/2020 0:00 9/16/2020 0:00 9/23/2020 0:00 10/6/2020 0:00 PRODUCTLINE Motorcycles Motorcycles Motorcycles Motorcycles Motorcycles Motorcycles Motorcycles Motorcycles Motorcycles MSRP 95 95 95 95 95 95 95 95 95 PRODUCTCODE S10_1678 S10_1678 S10_1678 S10_1678 S10_1678 S10_1678 S10_1678 S10_1678 S10_1678 COUNTRY USA France France USA USA USA France Norway USA TERRITORY NA EMEA EMEA NA NA NA EMEA EMEA NASolved1.2KViews0likes6CommentsNeed DAX Measure Correction
Dears, I need help with correcting the below DAX measure in which I target measuing progress from latest available date in the data report as it includes data from several dates please note that it only works well for the second argument but there is still an issue with the first and third ones, Overall Actual Progress = VAR LatestDate = CALCULATE(MAX('Project Calendar'[Date]), ALL('Weekly Progress'[Reporitng Date])) VAR SingleBuildingProgress = SELECTEDVALUE(SubAssets[BuildingName]) VAR EntireAssetProgress = SELECTEDVALUE(SubAssets[Asset Name]) VAR SelectedAssetBUA = SELECTEDVALUE('Weekly Progress'[Building BUA]) VAR TotalBUAForAsset = CALCULATE(SUM('Weekly Progress'[Building BUA]), SubAssets[Asset Name] = EntireAssetProgress, 'Weekly Progress'[Reporitng Date] = LatestDate) RETURN IF( ISBLANK(EntireAssetProgress), SUMX( FILTER('Weekly Progress', 'Weekly Progress'[Reporitng Date] = LatestDate), 'Weekly Progress'[Actual Progress] * 'Weekly Progress'[Building BUA] / SUMX( FILTER('Weekly Progress', 'Weekly Progress'[Reporitng Date] = LatestDate), 'Weekly Progress'[Building BUA] ) ), IF( NOT(ISBLANK(SingleBuildingProgress)), LOOKUPVALUE( 'Weekly Progress'[Actual Progress], 'Weekly Progress'[BuildingName], SingleBuildingProgress, 'Weekly Progress'[Reporitng Date], LatestDate ), CALCULATE( SUMX( FILTER('Weekly Progress', 'Weekly Progress'[Reporitng Date] = LatestDate), 'Weekly Progress'[Building BUA] * 'Weekly Progress'[Actual Progress] * DIVIDE( 1, TotalBUAForAsset ) ), SubAssets[Asset Name] = EntireAssetProgress ) ) )Solved1KViews0likes2CommentsFilters based on IDs
I have a table called 'TableBI' which stores the answers of multiple companies to multiple questions. It looks like this: Company ID Question Answer 1 Current Demand 0.3 1 Future Demand 0.2 1 Current Labor 0.4 1 Future Labor 0.5 2 Current Demand 0.5 2 Future Demand 0.4 2 Current Labor 0.3 2 Future Labor 0.2 3 Current Demand 0.3 3 Future Demand 0.3 3 Current Labor 0.6 3 Future Labor 0.7 I need to perform some calculations with the answers based on specific criteria. One of these criteria is that the Future Demand of the companies needs to be > 0.2. Therefore, I would like to create either a new filtered table or a new column that will include ALL the Answers of ONLY the companies for which when [Question] = Future Demand, [Answer] > 0.2. It should look like this: Company ID Question Answer Filtered Answer 1 Current Demand 0.3 1 Future Demand 0.2 1 Current Labor 0.4 1 Future Labor 0.5 2 Current Demand 0.5 0.5 2 Future Demand 0.4 0.4 2 Current Labor 0.3 0.3 2 Future Labor 0.2 0.2 3 Current Demand 0.3 0.3 3 Future Demand 0.3 0.3 3 Current Labor 0.6 0.6 3 Future Labor 0.7 0.7 This is very important, so thank you very much in advance!Solved1.2KViews0likes5Comments