conditional
15 TopicsDAX SelectedValue With If
Good morning, I would like to understand how to solve a problem that apparently is getting complicated. I have created a metric that is NumberOfPizza = VAR _qty = COUNTROWS( order_details ) RETURN IF( _qty = BLANK(), 0, _qty) And the next measure is SelectedValue = SELECTEDVALUE( order_details[pizza_id] ) The result is as follow How can I get the pizza type value to appear as a metric in the 0? Thank you in advanceSolved902Views0likes3CommentsConditional Formatting in Matrix using the Mean of a Column
I have a Measure called [Cascata Acumulado Rec sobre Total] that is a calculated measure, it shows the acumulated percentage in the Safra variable for the current Month (NOTE: I can`t calculate AVERAGE() of this measure) In the image below you can see the matrix I want to paint the background of the cell RED if the value is below the AVERAGE of that Month So this is what i want to have I've tried several approaches, but I couldnt figure it out, I know that my conditional formatting measure is something like this: Color = VAR ValorAtual = [Cascata Acumulado Rec sobre Total] VAR AvgMonth = [Medida MediaMes] RETURN IF( ValorAtual < AvgMonth, "Red", "White" ) The thing is, I need to kind of lock the Average just to calculate the AVERAGE of the month, so i can have something like this So that i can calculate my Conditional Formatting Measure to us in my matrixSolved627Views0likes1CommentNeed help with a DAX measure issue, that doesn't filter correctly.
hi Guys/Girls I've got a measure [FilteredTotal] & [Total], and i'd like to create a measure that returns the value from [Total] when the filter is active on the page, or else if filte is not active return the value for [FilteredTotal]. ConditionalTotal = IF ( ISFILTERED(ChartOfAccounts[Name]), [Total], [FilteredTotal] ) but this doesn't really work, because the value for [Total] still shows when no filter is chosen. what might be the problem? please ask if you need more info to answer/help967Views0likes5CommentsTrying to make a formula conditional by date depending on time from current date
Hi all, I am trying to implement the Excel formula in the below screenshots into DAX for use in a Power BI dashboard. Here is my data, the formula, and an explanation of what the formula does: If a date is over 6 days ago, I do not want to adjust its value. If a date is within 6 days of the current date but more than 2 days ago (so 3, 4, 5, or 6 days ago), I want to increase it by 11.5% each day for the number of days remaining until it hits 6 days. If a date was within the past 2 days, I want to increase it by 13% each day for the number of days remaining until it hits 6 days. The formula shown below accomplishes that in Excel. I am now trying to port the formula into Power BI. I used a formula identical to the one above, but I replaced DAYS() with DATEDIFF(). However, I get an error when trying to reference the date column, saying that "A single value for column 'Date' cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result."Solved957Views0likes4CommentsMeasure not working for running total with conditions (built on measures)
Please can someone help with this measure for a running total. The Power BI report with the model is available. Example files here. I'm trying to replicate the calculation in column E from the Excel file. This calculation in Excel caps the lowest value from column D i.e. if it's less than 0, it caps it at 0 so that negative numbers don't accumulate in the running total excessively. I don't know how to add this condition into my running total measure. This is the measure: Running Total Incorrect = VAR Reference = SELECTEDVALUE( 'DummyDataDemand'[ID], 0 ) RETURN SUMX ( FILTER ( SUMMARIZE ( ALLSELECTED ('DummyDataID'), DummyDataID[ID], "RunningTotal", [Exceeded Amount] ), 'DummyDataID'[ID] <= Reference ), [RunningTotal] ) I've also tried to add ADDCOLUMNS to this measure (because summarize used in this way has been depreciated) but I can't get it to work. Help with this would be appreciated.Solved5.7KViews0likes17CommentsReturning value from another table (multiple value but setting a preference what to return)
i have a scenario where i need to return a state of a something from a state tracker (i.e. table 1 below to table 2) as it will return multiple value for certain items, how could the Dax return value based on below scenario ? (i. if the item has Active state at all, always return Active & if there is no Active state but other multiple state , return either 1 -maybe first hit of state alphabetical order) been googling around, the nearest is to use FIRSTNONBLANK, but i cant assure Active state is always the first hit as in the case of SVR1 belowSolved1.7KViews0likes5CommentsCumulative value with conditions (or other solution)
Hello fellows! I have little experiencie with DAX. I've been trying to create an expression to solve my problem. I have a 3 tables. Initial Stock (not linked with DateTable, because it is a snapshot of my current stock position) Transit (linked with DateTable) Demand (linked as well) Final_Stock ( Initial Stock + Transit - Demand) Here is where I'm stucked, what I've been trying to accomplish. I have the initial stock and did the measure to give me the Final Stock for this month (Initial Stock + Transit - Demand) . However, for the calculation for the next months, the initial stock to be considered should be the final stock from previous month. The biggest problem I'm facing: If the final stock from previous month is negative, the next month should considere 0 as the initial stock and start over the process again. What I did and is not working well. Cumulative Total = CALCULATE(Medidas[Final_Stock], FILTER(ALL('Date'), 'Date'[Date] <= MAX('Date'[Date]) ) ) I tried to create a conditional formula, but is not working correctly. Any help will be appretiated!!! Thank you all.707Views0likes2CommentsSlicer not connecting to visualisation of calculated column
Hi Community, I'm fairly new to Power BI and seeking help for a project of mine. So, the situation is: I have company names in col1, their score in col2 (If rated). I want to create a measure that would consider the line items with a score as "Rated" and the one with blanks as "Not-rated" and visualise the count of rated and Non rated in a pie chart. As of now, I created a calculated conditional column and visualised that column in the pie chart, but if i do that, slicers are not affecting the data on the visualisation. I want the data of my pie chart to change according to slicers, which, from my search I've concluded can't be achieved with calculated columns. I hope I've articulated my question clearly, please ask for clarification if required. Thanks in advance.Solved2.7KViews0likes4CommentsConditional Count Measure
Hi Everyone, I am a fairly new user of PowerBi and I am having difficulties in creating a meausure that counts the number of distinct rows of a table and if the ID is a certain number, then this count is multiplied by two. In coding it would be fairly easy, but i am not sure how i would do this as a PowerBi measure: If StorageType = ("200 (Rack Doble Prof.)" OR "203 (Rack Doble Prof.)" OR "283 - 284 (Cam.Choc)"), THEN DISTINCTCOUNT('WM Stock(AMS-10)'[STORAGE_BIN])*2 Else DISTINCTCOUNT('WM Stock(AMS-10)'[STORAGE_BIN]) I am attaching the following visualization that I create to facilitate the comprehension of what I want to do. This visualization is a matrix that counts the rows, but what i would like to do is have the exact same table, such that the rows 200 (Rack Doble Prof.), 203 (Rack Doble Prof.) and 283 - 284 (Cam.Choc) are all multiplied by two. Thank you!!Solved1.9KViews0likes1Comment