dax
41 TopicsConditional Formatting on a Matrix & More
I've been stuck on a problem for my work for a while. I've made progress, but I can't seem to find a prooper solution to my conditional formatting issue. In Microsoft Power BI, I want to setup a matrix visual to show when the Doc Num of a Contract is New, Open, or Closed using Conditional Formatting. This will be over the course of different Verisons of Data pulls, and separated in different Unit groups. I want to ensure that I can adjust the DAX so that Closed only appears after a Doc Num disappears (e.g. not showing Closed in the same version it last appears) My current table has 3 columns: Doc Num, String Version, Decimal number Unit, String Lastly, I want to apply the conditional formatting to the matrix itself. This is because for each version, the Doc Num may change from New, to Open to Closed. Here's my current code: ContDocument Status = VAR _CurrentVersion = SELECTEDVALUE(DataPage_Tables_Append1[Version]) VAR _DocNum = SELECTEDVALUE(DataPage_Tables_Append1[DAC Doc Num]) VAR _CurrentUnit = SELECTEDVALUE(DataPage_Tables_Append1[Unit]) VAR _LastVersion = CALCULATE( MAX(DataPage_Tables_Append1[Version]), FILTER( ALL(DataPage_Tables_Append1), DataPage_Tables_Append1[DAC Doc Num] = _DocNum && DataPage_Tables_Append1[Unit] = _CurrentUnit ) ) VAR _FirstVersion = CALCULATE( MIN(DataPage_Tables_Append1[Version]), FILTER( ALL(DataPage_Tables_Append1), DataPage_Tables_Append1[DAC Doc Num] = _DocNum && DataPage_Tables_Append1[Unit] = _CurrentUnit ) ) RETURN SWITCH( TRUE(), _CurrentVersion = _FirstVersion, "New", _CurrentVersion > _FirstVersion && _CurrentVersion < _LastVersion, "Open", _CurrentVersion = _LastVersion, "Closed", BLANK() ) This is what the Output currently looks like: The problem is, that almost all Doc Nums are in Closed status at the last Version (unless the Doc Num is New during that Version), and that is not actually true. Some of those Doc Nums should be in Open status because it is not confirmed that the Doc Num disappeared. Another functionality that I want to add to my matrix, is to have a Doc Num be reopened in case there is an edit, and the Doc Num must be revisied. I do not know how to do this. Any guidance on this issue would be appreciated. Thank you in advance! Best, tkerr98Solved1.4KViews0likes6CommentsTrying to lookup value in table that has duplicates
I'm trying to lookup if a value exists in another table. This will determine whether to show/hide rows in the output based on whether there is a match. This is my data table: GroupAndMetricID InpatientM61 InpatientM61 InpatientM61 CommunityM61 CommunityM61 InpatientM59 CommunityM59 And my lookup table: GroupAndMetric InpatientM61 CommunityM61 InpatientM59 CommunityM59 So for each row in the data table I want to know if there is a matching value in the lookup table. I've tried these dax expressions, but get the errror 'a single value for column 'GroupAndMetricID' in table 'DataTable' cannot be determined...' MatchColumn = IF(CONTAINS (DataTable, DataTable[GroupAndMetricID], LookupTable[GroupAndMetric] ),1,0) MatchColumn = IF(LookupTable[GroupAndMetric] IN SELECTCOLUMNS ( RELATEDTABLE ( 'DataTable' ), DataTable[GroupAndMetricID]),1,0) I have tried using measures and columns for this but still the same error. Can anyone suggest a solution? ThanksSolved2.6KViews2likes7Commentsissue with a simple DAX function using REMOVEFILTERS
Hi everyone, I’m experiencing an issue with a simple DAX function using REMOVEFILTERS, which behaves as expected when tested in a DAX query view (e.g., with summarizecolumns) but fails to clear filters when used in a table or matrix visual in Power BI Report Server Desktop (September 2024 release). Here are the details: I have a very basic measure that uses REMOVEFILTERS to clear specific filters on a column. While this works perfectly in the DAX query editor, the visual context (table/matrix) still applies the filters, ignoring REMOVEFILTERS. I also tried alternative functions like ALL and ALLSELECTED, but they do not work in the visual either.938Views0likes2CommentsSuddenly stopped when to use quick measure
Feedback Type: Frown (Error) Error Message: An error occurred while rendering the report. Stack Trace: Javascript:TypeError at QuickMeasuresTemplateComponent_div_1_ng_container_1_div_10_ng_container_1_div_1_tri_dropdown_6_Template (518Views0likes1CommentHelp with slicer and measures with DAX (maybe)
Hi All I hope you can help me with my problem. I'm still relatively new to Power BI even if I've been lurking here for a while so please bear with me. Context: My model have a table that contains Department and Location columns and another survey results table that is joined by location. The department column contains two departments (Farming and Processing) while my location column have (Cashew Farming, Hazelnuts Farming, Hazelnut Processing, Cashew Processing, Pistachio, Processing etc.). I am using calculated measures from survey results to give me a percentage figures that I show in a table (for example the one below). I am also using a slicer that uses the departments (Farming and Processing). Problem: What I am trying to do now is if I select any department from the slicer (Farming for example), I would like the values to show only the ones for Cashew Farming, Hazelnut Farming, Pistachio Farming and if I change the selection to Processing, it will only show values for Cashew Processing, Hazelnut Processing, Pistachio Processing. Location Great Good Bad Cashew xxx xxx xxx Hazelnut xxx xxx xxx Pistachio xxx xxx xxx I hope that makes sense? I have a feeling that this is a DAX solution but I'm not sure where to start. Appreciate your help in advance! Thank you.Solved1.5KViews0likes6CommentsError: Comparison operations don't support comparing values type Text with Values of Type Number
Hi, I'm new to DAX and need some help, I'm creating a measure in a tabular cube in SSAS. I need to retreive the LastYearLastWeek data from x column: LastYearLastWeek:= CALCULATE([x], FILTER(ALL(Time), Time[WeekNumber] = SELECTEDVALUE(Time[WeekNumber]) -1 && Time[Year] = SELECTEDVALUE(Time[Year])-1)) But I get this error in the syntax: comparison operations don't support comparing values type Text with Values of Type Number. Considering using VALUE or FORMAT functions to convert one of the values. Fields used: WeekNumber and Year from Time table are whole numbers. It doesn't really make sense to me, any tips on how to fix it? Also maybe there is a better way to get LastWeekLastYear, do you know of any? ThanksSolved1.4KViews0likes2CommentsWrong data displayed on Report Server
In my powerbi file I have several calculated columns. My organization uses PowerBI 2021 September version. Problem I'm having is with this one in particular: I'm calculating difference in minutes between two datetime columns. Another column is created to assign ID ranges to time for instance if time difference is less than 30 minus I'll return 1 for its range. I have another ranges and labels table which is connected to my table on this calculated ID of 1 with corresponding text label "<30 min" that I'm using to display in a table visual. Wherever it's possible I'm using SWITCH statement. If I refresh the report (it's based on import query) on desktop ranges are assigned correctly and where it's calculated range is 1, it's getting assigned correct range but when the report is published to the server instead of "<30 min" it might display "4-8hours". Can anyone suggest what can be potentially wrong or how do I debug to find the issue?851Views0likes2CommentsIf date value is not blank return date value if date value is blank return "Text"
Hello I need a measure for a card visual to display a date value if present however if it's blank display a custom text such as "NONE" The date field(expectedresultdate) is a data type of "Date". The custom text if the field is blank is just "Text". Heres what I have. next update = IF(ISBLANK(SELECTEDVALUE('Annual Metrics'[ExpectedResultDate])),SELECTEDVALUE('Annual Metrics'[ExpectedResultDate],"NONE"),SELECTEDVALUE('Annual Metrics'[ExpectedResultDate])) Thank you,Solved1.4KViews0likes5CommentsAdd parameter in query designer (query from Power BI Performance analyser)
Hi guys, I am trying to add a parameter in my report and add the parameter in the query designer module. The query was generated within Power BI via Performance analyser. I saw different posts on this issue but no clear solution. First I have tried to create a parameter in the report (in my dataset properties) and add it with @ in my query such as // DAX Query DEFINE VAR __DS0FilterTable = TREATAS({@Test}, 'FACT - Conflicts'[Conflict category]) However, I have an error message that the parameter test was not declared. So I declared it again through "Query Parameters" module within the query designer (same name and another name). This time I can execute the query but it returns no row with a default value "Group" (which should not be the case - if I had put TREAT({"Group"}, it returns some rows). I tried to see what were the values in the Parameters properties window and I can see this. Which I don't understand because "Test" is not the name of my dataset.. Any idea to resolve this? Thanks a lot in advance!Solved6.3KViews0likes5CommentsField Parameter Work Around
Good Day All I hope you can advice me on a way to use DAX to create a Field Parameter like function. I want to use a bar or column chart to display the total counts per User based on a paramter I created. I can add my Switch measure for counts on the x - axis but when I do something simular for the users it does not work when I add it to the y - axis. Every google search I do points back to the Desktop version of Field Parameters But PowerBI RS does not have that function. Data: I have one main table with all the data. In this table i have a column with a unique number that I use for counts. I have TimeStamp columns for each process of the unique number and with the TimeStamp there is a User I have duplicated the main Users table into the diffrent processes. UserAcknowledged, UserPhoned, UserCompleted. I created an index And then linked them to the Main Table on the individual UserID's, the TenantID's, and ClientID's Take Note: I have another version Where I kept the UsersTable as one table but broke up the Main table in the diffrent pressess but that increased my file size alot but I was at least able to design my chart. I created a Slicer measure that will control the counts and hopefully the users all at once (Slicer)_OperationStages = UNION( SELECTCOLUMNS( GENERATESERIES(1, 7, 1),"ID", [Value], "StageDesc", SWITCH( [Value], 1, "All", 2, "Acknowledged", 3, "Phoned", 4, "Completed", 5, "Canceled", 6, "Dispatched Stack", 7, "Dispatched") ), ROW("ID", 0, "StageDesc", "Unknown") -- Add an "Unknown" stage with ID 0 if needed ) When I create the Switch function measure for users it does not allow it to pined to the bar chart visual _Exp.Switch.All(Users) = VAR SelectedStageID = SELECTEDVALUE(('(Slicer)_OperationStages'[ID])) RETURN SWITCH ( SelectedStageID, 2, SELECTEDVALUE('dimUsers(Ack)'[Username]), 3, SELECTEDVALUE('dimUsers(Phn)'[Username]), 4, SELECTEDVALUE('dimUsers(Com)'[Username]), 5, SELECTEDVALUE('dimUsers(Can)'[Username]), 7, SELECTEDVALUE('dimUsers(Disp)'[Username]), BLANK() -- Return blank if no selection or unexpected ID ) Is there any advice that someone can provide to help me.Solved2.2KViews0likes5Comments