Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all!
I have what may be kind of a complex issue.
I'm currently working with a data set in power query and wondering whether there was any way (within either power query, if not perhaps within power pivot?) to create a flag that will place students in one of three 2 categories based on the ordre in which they completed a test.
For example, a student who completed an English test on August 20th, Math on the 24th and Science on the 28th would be categorized as a 1.
A student who completed an English test on August 20th, [B][I]Science[/I][/B] on the 24th and Math on the 28th would be categorized as a 2.
Attached are screenshots of a workbook containing a stripped down, modified sample of my data set as well as the result I would like to achieve.
Any suggestions would be greatly appreciated.
Thank you!
Darko
Solved! Go to Solution.
Hi @Darko_Giac,
I'm not good at power query but I think you could achieve that use dax formula.
You coud create a calculated column with the dax formual below.
Column = IF ( AND ( CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MIN ( 'Table1'[Date] ) ) ) = "Math", CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MAX ( 'Table1'[Date] ) ) ) = "Science" ), 1, IF ( AND ( CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MIN ( 'Table1'[Date] ) ) ) = "Math", CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MAX ( 'Table1'[Date] ) ) ) = "English" ), 2 ) )
Here is the output.
If you still want to achieve that with power query, you could get help in TechNet forum.
Best Regards,
Cherry
Hi @Darko_Giac,
I'm not good at power query but I think you could achieve that use dax formula.
You coud create a calculated column with the dax formual below.
Column = IF ( AND ( CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MIN ( 'Table1'[Date] ) ) ) = "Math", CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MAX ( 'Table1'[Date] ) ) ) = "Science" ), 1, IF ( AND ( CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MIN ( 'Table1'[Date] ) ) ) = "Math", CALCULATE ( MAX ( 'Table1'[Test] ), FILTER ( 'Table1', 'Table1'[ID] = EARLIER ( Table1[ID] ) && 'Table1'[Date] = MAX ( 'Table1'[Date] ) ) ) = "English" ), 2 ) )
Here is the output.
If you still want to achieve that with power query, you could get help in TechNet forum.
Best Regards,
Cherry
Thanks so much! Worked exactly like I had hoped!
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
110 | |
94 | |
82 | |
66 | |
58 |
User | Count |
---|---|
151 | |
121 | |
104 | |
87 | |
67 |