tips and tricks
263 TopicsAdvanced Ranking (Rankx)
Hi, I am struggling with ranking measures in Power BI. I have visual sorted descening by Number of Points (field Current) and I want to rank all filtered Analysts by this measure. I cannot share my workbook there as it is strictly confidential but let's imagine below data: Perfect Rank Rank (Current) Analyst Corp Rank Team Current Raw Weighted 1 1 Ann a Sales 4666 445 4666 2 2 Tom a Finance 4000 555 4000 3 3 Henrik a HR 3600 56 3600 4 4 John a HR 3580 456 3580 5 1 Johanna b Sales 3000 666 3000 6 2 Robert b Sales 2900 666 2900 7 3 Sarah b Sales 2899 567 2899 8 4 Joy b Sales 2801 7888 2801 9 5 Patrick b Sales 2800 788 2800 10 6 Steven b Sales 2780 788 2780 11 1 Alicia c Finance 2705 7858 2705 12 2 Carol c Finance 2700 7888 2700 13 3 Ursula c Finance 2690 7888 2690 14 4 Adrian c Finance 2600 888 2600 15 5 Milos c Finance 2560 88885 2560 16 1 Dorothy d Account 2501 4 2501 17 2 Tanja d HR 2500 447 2500 18 3 Chris d HR 2407 788 2407 19 4 Dominika d HR 2406 448 2406 20 5 Nicola d HR 1000 4888 1000 CurrentPoints is a measure dependednt on user selection in slicer: Raw or Weighted [Points] Final formula look CALCULATE ( [Points], KEEPFILTERS ( 'BV'[Last or prev] = "Last" ), // Limit to clients that pass the slicer gating KEEPFILTERS ( FILTER ( ALLSELECTED ('BV periods'[Client]), [Client Filter (by Slicer)] = 1 ) ) ) [Points] is formula which switches to raw or weighed, based on user selection. Last or Prev is filter for current period I tried with simple formula: Rank = RANKX(ALL('BV'[Analyst]),[Current],,DESC,Dense) but it produces only 1 for all Analysts Copilot adviced me another formula to exclude other fields used in visual: Rank (Current) = VAR _thisScore = CALCULATE( [Current], REMOVEFILTERS('BV'[Team]), REMOVEFILTERS('BV'[Corp Rank]) ) -- Distinct analysts in the currently selected slicer context, -- but explicitly ignoring Team and Corp Rank row context VAR _analystSet = CALCULATETABLE( VALUES('BV'[Analyst]), ALLSELECTED('BV'), REMOVEFILTERS('BV'[Team]), REMOVEFILTERS('BV'[Corp Rank]) ) -- Compute Current for each analyst in that set, ignoring Team/Corp Rank VAR _set = ADDCOLUMNS( _analystSet, "Score", CALCULATE( [Current], REMOVEFILTERS('BV'[Team]), REMOVEFILTERS('BV'[Corp Rank]) ) ) RETURN IF( ISBLANK(_thisScore), BLANK(), RANKX( _set, [Score], _thisScore, DESC, DENSE ) ) And it produced almost corect ranks but recalculated after every Corp Rank. Do you have any ideas what I can do? I want this rank to be sensitive to filters I have in report.Solved949Views0likes5CommentsMicrosoft Fabric Known Issues
Known issues are temporary bugs that we've discovered in Microsoft Fabric. These bugs are known and are being actively fixed. Before you submit a Support request, or search Community forums for an answer, see if the problem that you're experiencing is already known to Microsoft. There are two locations to look up current known issues: Known issues as a list on Learn Known issues page on the Fabric support site To create a support ticket, visit https://learn.microsoft.com/en-us/power-bi/support/create-support-ticket. For service level outages or degradation notifications, check https://support.fabric.microsoft.com/.11KViews9likes1CommentIssue with Conditional Formatting in Matrix Visual
Hi Team, Hope you're all doing well. I was working on applying conditional formatting in the Matrix visual, where I have a column called "ppk" and I am applying the following criteria to achieve color coding using DAX. Using this DAX (with averages included): DAX PPK_Conditional_Color_heatmap = VAR Ppk_Value = AVERAGE('PPK'[ppk_vl]) // No COALESCE applied VAR StdDev_Value = AVERAGE('PPK'[stddev_vl]) // No COALESCE applied RETURN SWITCH( TRUE(), Ppk_Value = 0 && StdDev_Value = 0, "#808080", // Grey for NULL Ppk & StdDev is Blank Ppk_Value = 0 && StdDev_Value = 0, "#ADD8E6", // Light Blue for NULL Ppk & StdDev = 0 Ppk_Value >= 1.33, "#69b764", // Green Ppk_Value >= 1.00 && Ppk_Value < 1.33, "#ffc156", // Yellow Ppk_Value < 1.00, "#d82526" // Red ) The criteria for coloring are as follows: Ppk >= 1.33 → Green Ppk >= 1.00 && Avg_Ppk < 1.33 → Yellow Ppk < 1.00 → Red PPK = NULL & StdDev_Vl = 0 → Light Blue PPK = NULL & StdDev_Vl = Blank → Grey However, after applying the formula, the grey and light blue colors are not showing as expected. I believe the issue is that when the cell is empty, the conditional formatting is not triggering. This might be because blank values aren’t being accounted for correctly in the DAX expression. Has anyone encountered this issue, or do you have any suggestions on how to address it? Looking forward to your inputs. Thanks & Regards, Hk996Views0likes5CommentsDynamic DAX to show text of Parameter Selection Values
I have a number of slicers on my report, too many to show on the report so have created a slicer pane to hide the slicers when not required. The problem with this is that when the slicer pane is hidden you can't tell what has been selected on the report. To try to solve this I have created a small text box that dynamically shows what has been selected in the slicers. e.g. 'Hidden filters selected - Academic Years - 2023/4, Domicile - All, Fee Status - All' I can produce this with variations of VAR variables and CONCATINATEX(...). I have got it to work for Parameter slicers, but not for Parameter Slicer Values. Char F below will show the characteristics selected e.g. VAR CList = "Characteristic - " & CONCATENATEX('Characteristic Parameter - Awarded', 'Characteristic Parameter - Awarded'[Characteristic Parameter Order], ", " ) VAR CharF = IF(CList= "Characteristic - Sex, Ethnicity, Ethnicity Detailed, Disability, Age, POLAR4 Quintile, IMD Quintile, Domicile, Region, Parent HE Educated, Welsh Speaking" ,"Characteristic - All", CList ) Return CharF But I'd like to now how to get a version to work to show what selected paramter value has been selected. e.g Parameter - Sex , Paramteter Value - MaleSolved2.3KViews0likes10CommentsExtended period chosen?
Hi people, I hope you can help me with a challange: I have a table, which partly looks like this: now, I want to use the "visit date" to choose a period ("from-to" date filter), but I need to see the "calendar dates" and "sale" by date, 5 days before the "visit date"-period starts (MIN visit Date) and 5 days after the period ends (MAX visit date). how do I make this DAX (it is possible to make a calculated table/column as well as a measure)? All help and inspiration is appreciated. Thanks Br, JayJay0306Solved6.2KViews0likes6CommentsAccrued Vacation formula in power BI
Hi, I am working on tracking PTOs in power Bi. I want to create a DAX query on the basis of below parameters 1.) 0 – 2 years = 10 days per year 2 – 10 years = 15 days per year 10+ = 20 days per year 2) If anyone joins on or before 15th of a particular month, then he/she gets leaves for that particular month else from next month onwards. 3) Also, if any employee hits milestone in the current year, e.g. if one of the employee who joined on 9-aug-2022 is completing 2 yr milestone oln 9-aug-2024, ideally his accrual should be =((10/12)*7) + ((15/12)*4)=10.83 . I have tried using below formula but somehow it is not giving me desired output. Let me know if anyone has any inputs or suggestions... Accrued Vacation = VAR StartDate = SELECTEDVALUE('Employee Roster'[Start Date]) VAR CurrentDate = TODAY() VAR CurrentYear = YEAR(CurrentDate) VAR StartYear = YEAR(StartDate) VAR StartMonth = MONTH(StartDate) VAR CurrentMonth = MONTH(CurrentDate) VAR StartDay = DAY(StartDate) VAR Tenure = DATEDIFF(StartDate, CurrentDate, YEAR) VAR AnniversaryDate = DATE(YEAR(StartDate) + Tenure, MONTH(StartDate), DAY(StartDate)) -- Determine Monthly Accrual Rates VAR MonthlyAccrualBefore = SWITCH( TRUE(), Tenure < 2, 10 / 12, Tenure < 10, 15 / 12, 20 / 12 ) VAR MonthlyAccrualAfter = SWITCH( TRUE(), Tenure + 1 < 2, 10 / 12, Tenure + 1 < 10, 15 / 12, 20 / 12 ) -- Determine Effective Date for New Joins VAR EffectiveDate = IF(StartYear = CurrentYear, IF(StartDay <= 15, DATE(CurrentYear, StartMonth, 1), EOMONTH(StartDate, 0) + 1), DATE(CurrentYear, 1, 1) ) -- Calculate Months Before and After Anniversary VAR MonthsBeforeAnniversary = IF( AnniversaryDate <= CurrentDate, DATEDIFF(EffectiveDate, AnniversaryDate, MONTH), DATEDIFF(EffectiveDate, CurrentDate, MONTH) ) VAR MonthsAfterAnniversary = IF( AnniversaryDate <= CurrentDate, DATEDIFF(AnniversaryDate, CurrentDate, MONTH), 0 ) -- Calculate Total Accrued Vacation VAR AccruedVacation = IF( DAY(AnniversaryDate) <= 15, (MonthlyAccrualBefore * MonthsBeforeAnniversary) + (MonthlyAccrualAfter * (MonthsAfterAnniversary + 1)), (MonthlyAccrualBefore * (MonthsBeforeAnniversary + 1)) + (MonthlyAccrualAfter * MonthsAfterAnniversary) ) -- Adjust for the specific case where the anniversary date is after the 15th of the month VAR FinalAccruedVacation = IF( DAY(AnniversaryDate) > 15, (MonthlyAccrualBefore * MonthsBeforeAnniversary) + (MonthlyAccrualAfter * MonthsAfterAnniversary), AccruedVacation ) -- Ensure correct calculation for milestones within the current year VAR CorrectedAccruedVacation = IF( Tenure = 1 || Tenure = 9, (MonthlyAccrualBefore * (MonthsBeforeAnniversary + 1)) + (MonthlyAccrualAfter * MonthsAfterAnniversary), FinalAccruedVacation ) RETURN ROUND(CorrectedAccruedVacation, 2)Solved1.6KViews0likes6CommentsHow to get distinct cumulative Sum of Day wise
Hi Community Member, Please help me to achieve some desired result using power bi dax. Please see the attached details explanation and output we need. See below calculation that we need to convert into power bi dax to achieve output mentioned right side below.Solved728Views0likes2Commentscumulative sum by date and product
hello, please help me i am trying to make cumulative sum (running sum) table for every day in year and by product, this is the example date product value 1-Jan-21 ayam 1 1-Jan-21 bebek 2 2-Jan-21 ayam 3 2-Jan-21 bebek 4 3-Jan-21 ayam 5 3-Jan-21 bebek 6 i got on internet this formula running sum = CALCULATE( SUM('Sheet1'[Value]), FILTER(ALLSELECTED('Sheet1'), 'Sheet1'[date] >= DATE(YEAR(MAX('Sheet1'[date])),1,1) && 'Sheet1'[date] <= MAX('Sheet1'[date]) )) from that formula i got table like this date product value cumulative sum 1-Jan-21 ayam 1 3 1-Jan-21 bebek 2 3 2-Jan-21 ayam 3 10 2-Jan-21 bebek 4 10 3-Jan-21 ayam 5 21 3-Jan-21 bebek 6 21 i hope the result like this date product value cumulative sum 1-Jan-21 ayam 1 1 1-Jan-21 bebek 2 2 2-Jan-21 ayam 3 4 2-Jan-21 bebek 4 6 3-Jan-21 ayam 5 9 3-Jan-21 bebek 6 12 how to make table like this? thanks in advanceSolved72KViews0likes8CommentsYoY Measurements - Measure to Exclude Clients that don't have data for same period previous year
I have 38 clients, with unique identifier, and as I work to get accurate YoY reporting, I need to exclude clients that came on mid year. For example, say in 2022 I had 5 clients and $1M in sales, and then in 2023 I had 8 clients with $2M in sales, I am not comparing apples to apples. I need to be comparing the same 5 clients from 2022 to the same 5 clients in 2023 (exlcuding the 3 new clients in 2023) in order to get accurate YoY variances for our industry. For the client I do have their start date so could use that as part of the filter or exlcusion data, but from there I am at a loss. Any guidance would be much appreciated.1.3KViews0likes4CommentsForecast measure with fixed % increase
Dear reader, I have a line chart that has data up untill the current month. Using a YTD / YOY calculation I have a fixed % Change measure. I want to use that [% Change YOY] measure to forecast the rest of the year, starting from my max [Month]. My line chart has a cumulative [Sales] total of: $ 100 in May.. What I expect: June = $100 * [% Change YOY] Juli = June * [% Change YOY] Aug = Juli * [% Change YOY] etc. Could you help me write this measure? 🙂 Kind regards, DaniëlSolved708Views0likes2Comments