dax grouping and counting
3 TopicsNeed help with grouping a variable
I have a variable called program. The data in program conforms to the format year-program where year can equal any year in the format yyyy, and program can be either 01, 04, 06, 09, 12. For example 2019-01, 2019-04, 2020-01, 2020-04, 2020-06. I would like to create a new measure called 'program-grouped', where any program ending in '01' is called January, any program ending in '04' is called April, and any program ending in '06' is called June. I tried the following but it did not work. Any ideas? Program-Grouped = SWITCH( TRUE(), RIGHT([program], 2) = "01", "January", RIGHT([program], 2) = "04", "April", RIGHT([program], 2) = "06", "June", "Other" )Solved1.2KViews0likes5CommentsAverage Between Three Dates Versus Main Date
I am creating a dashboard to show the days between(Lag) the latest of three different date columns versus the main date(Physical Date) column. Now I need to find the average days between those three different date columns versus the main date(Physcial Date) column and present it in a visual like a bar or line chart. Example: Product Order was placed and shipped(Physical Date)and it goes into either three different date column flows: 1) Submission Date(Meaning it is the normal price and it goes straight to invoicing) 2) Price Approved Date(The product has a special price so that price needs to get approved before it goes to invoicing) 3) Terms Approved Date(The product price has different terms than normal so that needs to be approved) They want to know how many days it took to move between main date(Physical Date) to Price approved date, or between Main Date (Physical Dat)e to submission date etc. Currently I am using a calulcated column to find the last date of the three dates compared to the main date(Physical Date) in days. DaysBetween Lag Column = VAR _pDate = SELECTEDVALUE('TABLE1'[Physical Date]) VAR _paDate = SELECTEDVALUE(Table1[PriceApproved.date]) VAR _taDate = SELECTEDVALUE(Table1[Terms Approved Date]) VAR _sDate = SELECTEDVALUE('Table1'[Submission.date]) VAR _maxDate = MAX(MAX(_paDate, _taDate), _sDate) RETURN DATEDIFF(_pDate, _maxDate, DAY) That column displays in a table like this: They are wanting to group by the latter of the three dates (Price Approved Date, Submission Date, Terms Approved Date) versus physical Date and then get the average of that. The average part is what I am needing help with. Any suggestions please? Data Table is just sample data. Please Note: The three dates (Submission Date, Price Approved Date and Terms Approved Date) will not always have a value depending on what "flow" the item went into it after it was shipped. Dangar332 or anyone else...Any suggestions Please? Thank you in advance! Product ID Physical Date Submission Date Price Approved Date Terms Approved Date 24567 1/4/2024 1/7/2024 676742 1/6/2024 1/10/2024 42516 1/15/2024 1/26/2024Solved580Views0likes2CommentsDAX command - to group number of issues in students
Hi, Thank you so much for helping. I'm in a university as an advisory faculty to student issues. Here's the data I loaded into Power BI: Table 1 Name Issues David Academic David Psychosocial David Financial Betty Academic Betty Pyschosocial John Academic John Financial Rachel Psychosocial Rachel Professional Fred Academic Cindy Academic George Psychosocial Ella Financial Simon Professional I have no problems doing this: Issues Number of Students Academic 5 Psychosocial 4 Financial 3 Professional 2 What I did was to create a measure: Count = COUNTROWS(Table1) Then I selected Table in Visualisation, clicked on Issues and the new measure Count (like the graphic below) and it returns the table above: But what I really want to do is to construct a Table 2 from Table 1 to count how many students have how many issues: like this: Table 2 Number of Issues Number of Students 3 1 2 3 1 5 What measures or columns in DAX do I create so that I can click them to get the table 2 visualization? Thank you so much! This is driving me mad! YS, NgSolved501Views0likes2Comments