Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be 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

Reply

If the first row is equal to a name, replace the rest of values of that column with null

I have a table as below:

Test ATest BTest C
83918701779
1556613884
11615881962

 

 

I also have a "Date Table" as below:

Q means Quarter. 

Test ATest BTest C
02/5/202012/12/201905/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 ATest BTest C
Completed18701779
 613884
 5881962

 

Is there any way to do this in Power BI Query?

Any help is appreciated. 

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @pouyanebrahimi 

 

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.

04.PNG

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

View solution in original post

5 REPLIES 5
v-diye-msft
Community Support
Community Support

Hi @pouyanebrahimi 

 

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.

04.PNG

 

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.

@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 ATest BTest C
Q1 202015001200648
Q4 20191900500795
Q3 20191850551684
Q2 2019999755888
Q1 2019190018262000
Q4 201814006281050

 

Date table: 

Test ATest BTest C
Q1 2020Q2 2019Q4 2019

 

Then the result should be:

 Test ATest BTest C
Q1 2020Completed1200648
Q4 2019 500Completed
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. 

parry2k
Super User
Super User

@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.

 

 

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.