March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a table as below:
Test A | Test B | Test C |
839 | 1870 | 1779 |
1556 | 613 | 884 |
1161 | 588 | 1962 |
I also have a "Date Table" as below:
Q means Quarter.
Test A | Test B | Test C |
02/5/2020 | 12/12/2019 | 05/07/2019 |
Today is June 4, 2020 (Quarter 2, 2020). If the date in "Date Table" is the Previous Quarter (right now, the previous quarter is Q1 2020), then I want to replace all the values of that column with "null" and right "Completed" on the first row. The result will be as below:
Test A | Test B | Test C |
Completed | 1870 | 1779 |
613 | 884 | |
588 | 1962 |
Is there any way to do this in Power BI Query?
Any help is appreciated.
Solved! Go to Solution.
Let me know if you'd like to get below results, but you need to add an index column for distinguishing. I do a trick here to hide the index column by special formatting.
Pbix attached.
Let me know if you'd like to get below results, but you need to add an index column for distinguishing. I do a trick here to hide the index column by special formatting.
Pbix attached.
@v-diye-msft I just oppened your file using my peronal computer, instead of Company computer. Thanks!
Would it be possible for you to explain a little bit your DAX codes that you used for making a measures? I am new in Power BI and get myself familarize with M not DAX, I guess I should start DAX as well 🙂
MeasureforA = var a = MAXX(ALL('Table'),[Test A])
Return
IF(QUARTER(MAX('Table (2)'[Test A]))=QUARTER(TODAY())-1,IF(MAX('Table'[Test A])=a,"Complete",BLANK()),MAX('Table'[Test A]))
Can we expand this method a bit to cover the following thing as well?
Test A | Test B | Test C | |
Q1 2020 | 1500 | 1200 | 648 |
Q4 2019 | 1900 | 500 | 795 |
Q3 2019 | 1850 | 55 | 1684 |
Q2 2019 | 999 | 755 | 888 |
Q1 2019 | 1900 | 1826 | 2000 |
Q4 2018 | 1400 | 628 | 1050 |
Date table:
Test A | Test B | Test C |
Q1 2020 | Q2 2019 | Q4 2019 |
Then the result should be:
Test A | Test B | Test C | |
Q1 2020 | Completed | 1200 | 648 |
Q4 2019 | 500 | Completed | |
Q3 2019 | 55 | ||
Q2 2019 | Completed | ||
Q1 2019 | |||
Q4 2018 |
@v-diye-msft Thanks for the answer. However, I cannot open your Pbix file. Would it be possible for you to take screenshots of different steps and share it with me please?
I found one problem in your answer. The first and second rows for Test B and C are exchanged.
@pouyanebrahimi sorry your question is not clear to me, could you please bit more. Cannot make out how you data is linked to the dates and what to make null and what you want in final output.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@parry2k Two tables are not connected yet! But we can connect them by appending or merging.
The point is, if the date "Date Table" is within the previous quarter of the year, we do not need additional information from the first table.
Example 1:
For test A, the "Date Table" is Q1-2020, so, we do not need additional information for the Column A of First Table. In other word, In table 1, Column A, we should only mention "Completed."
Example 2:
For the test B, in "Date Table", the dates are not in previous quarter (they are not Q1-2020), so we will keep their information as it is.
As the result table shows, the table 1, will be the same results table for test B and Test C. The only differenc ebetween table 1 and result table is in column 1 which is for Test A.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
129 | |
90 | |
75 | |
58 | |
53 |
User | Count |
---|---|
200 | |
104 | |
101 | |
67 | |
55 |