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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Simple Previous Quarter Current Quarter Table from Large Dataset

Hey All

 

I am trying to create a Table like below

RoMis88_0-1722931003357.png

Now the data set i have has contracts with their Current Segment and Previous Quarter Segment in the Data as written in the final segment column. As such I want have this simple table setup where I can use a seperate table where I ensure all these segments are already set up and then do a count if for current quarter on the current segment column and previous quarter on the previous quarter segment.

 

Looking online i cant for the life of me find something that will do this or just a simple count if function in Power BI

1 ACCEPTED SOLUTION

Hi @Anonymous 

Thanks for sharing.

Can you create an extra table for the Segment Status? You can use the "Enter Data" feature in the ribbon. Make sure the spelling is correct as we need them to match with what is in the last two columns of your table.

Joe_Barry_0-1723007801914.png
Go to the Model View and create a one to many relationship from the DIM Segment Table, Segment Column to the Final_Segment column of your table. Do the same for the Previous_Quarter_Final_Segment, this will be an inactive relationship.

Create two measures

Final Segment = 
CALCULATE(
    DISTINCTCOUNT('Table'[Contract ID]),
    KEEPFILTERS('Table'[Final_Segment] <> BLANK())
)
Previous Quarter Segment = 
CALCULATE(
    DISTINCTCOUNT('Table'[Contract ID]),
    KEEPFILTERS('Table'[Previous_Quarter_Final_Segment] <> BLANK()),
    USERELATIONSHIP('DIM Segments'[Segment], 'Table'[Previous_Quarter_Final_Segment]
))



Create a table visual and add the Segment column from the DIM Segment table, then add both measures above

Joe_Barry_1-1723008421590.png

 



Hope this helps

Joe

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


View solution in original post

4 REPLIES 4
Joe_Barry
Super User
Super User

Hi @Anonymous 

 

Can you share a snaphot of the table? Especiallythe column names and just put some fake data in in one row. I'll see if I can help

Joe




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Anonymous
Not applicable

@Joe_Barry here is what the the data would look like in the underlying table:

 

Contract IDFinal_SegmentPrevious_Quarter_Final_Segment
XXXXXXX  
XXXXXXX4 – Low Risk4 – Low Risk

Hi @Anonymous 

Thanks for sharing.

Can you create an extra table for the Segment Status? You can use the "Enter Data" feature in the ribbon. Make sure the spelling is correct as we need them to match with what is in the last two columns of your table.

Joe_Barry_0-1723007801914.png
Go to the Model View and create a one to many relationship from the DIM Segment Table, Segment Column to the Final_Segment column of your table. Do the same for the Previous_Quarter_Final_Segment, this will be an inactive relationship.

Create two measures

Final Segment = 
CALCULATE(
    DISTINCTCOUNT('Table'[Contract ID]),
    KEEPFILTERS('Table'[Final_Segment] <> BLANK())
)
Previous Quarter Segment = 
CALCULATE(
    DISTINCTCOUNT('Table'[Contract ID]),
    KEEPFILTERS('Table'[Previous_Quarter_Final_Segment] <> BLANK()),
    USERELATIONSHIP('DIM Segments'[Segment], 'Table'[Previous_Quarter_Final_Segment]
))



Create a table visual and add the Segment column from the DIM Segment table, then add both measures above

Joe_Barry_1-1723008421590.png

 



Hope this helps

Joe

 




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Learn about the Star Schema, it will solve many issues in Power BI!

Date tables help! Learn more



LinkedIn
Let's connect on LinkedIn


Anonymous
Not applicable

Absolute Legend works perfectly!!!

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!

December 2024

A Year in Review - December 2024

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