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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Joshi_AB7071
Regular Visitor

DAX flag for Last Completed Quarter

Hello DAX guru's

 

I'm trying to create a filter in the DimDate table ,
which would put the flag as True when the data is in last completed Quarter.
In my dashboard Fiscal Year starts from October to September.
Last completed Quarter would be True only when all the 3 months of this quarter completed.


Example:
When this month is November 23, (July,August,September 2022 ) - are 2022 Q4 last completed/Full Quarter.

So, July 22,Aug 22,Sep 22 should flag as True and OCT,NOV should flag as False Until OCT,Nov,DEC completes.

 



Any help would be greatly appreciated.

Thanks in advance,
A Joshi

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Joshi_AB7071 ,

I created a sample file(see the attachment) base on your provided sample data, please check that is what you want. You can create two calculated columns as below to get it:

Fiscal Year Quarter = 
'Table'[FY]
    & IF (
        'Table'[Month] IN { "Oct", "Nov", "Dec" },
        "Q1",
        IF (
            'Table'[Month] IN { "Jan", "Feb", "Mar" },
            "Q2",
            IF ( 'Table'[Month] IN { "Apr", "May", "Jun" }, "Q3", "Q4" )
        )
    )
Flag = 
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[Fiscal Year Quarter] ),
        FILTER (
            'Table',
            'Table'[Fiscal Year Quarter] = EARLIER ( 'Table'[Fiscal Year Quarter] )
                && 'Table'[Amount] > 0
        )
    )
RETURN
    IF ( _count = 3, "True", "False" )

yingyinr_0-1669084008920.png

Best Regards

View solution in original post

8 REPLIES 8
lbendlin
Super User
Super User

Sounds straightforward (assuming your calendar table is in import mode or has a local copy.  You would create a calculated column that implements your logic.

 

What have you tried and where are you stuck?

Hi Thanks for your time.

 

The data source for this dashboard is Azure Blob storage . final requirement is to restrict my bar chart to show data  upto completed quarter.

 

Im new to Power BI and im planning to create flag for this and want to use in main DAX formula to restrict x axis display. Actually im not getting idea how to create flag for below data.

Last completed quarter.jpg

Anonymous
Not applicable

Hi @Joshi_AB7071 ,

How can we judge if every month is completed or not? Is there any fact table in your model? Could you please provide more details(sample data with Text format, screenshot and special examples etc.) on your requirement? It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

Hi,

Dashboard has Amount field to decide wherther the Month is completed or not. 

Since im a new to community, Dont have option to attach sample data file/PBIX.

 

Alternatively i can give snapshot of my fact table table as attached.Fact table data.jpg

 

Thanks,

A joshi

 

 

Amount

 

 

MonthFYFiscsl period IDFiscal quarted  IDFiscal Period Start Date
 

100

 

OCT
2022

 

265

89

 

 

9/26/2021 0:00

 

 

100Nov20222668910/24/2021 0:00
100 Dec20222678911/21/2021 0:00
 

100 

 

Jan20222689012/26/2021 0:0
 

100 

 

Feb2022269901/23/2022 0:00
 

100 

 

Mar2022270902/20/2022 0:00

100

 

Apr

2022

 

27191
 

3/27/2022 0:00

100May2022272914/24/2022 0:00

100

 

Jun2022273915/22/2022 0:00

100

Jul2022274926/26/2022 0:00

100

Aug

2022

 

275927/24/2022 0:00

100

Sep2022276928/21/2022 0:00

100

Oct2023277939/26/2022 0:00

 

Nov20232789310/24/2022 0:00

 

Dec20232799311/21/2022 0:00

 

Jan20232809412/26/2022 0:00

 

feb2023281941/23/2023 0:00

 

Mar2023282942/20/2023 0:00

Here is the sample Data for reference,  i need to create flag for completed quarter . if we have Amounts for all the 3 Months  then the flag should be True otherwise false

 

Thanks in advance,

A joshi

Anonymous
Not applicable

Hi @Joshi_AB7071 ,

I created a sample file(see the attachment) base on your provided sample data, please check that is what you want. You can create two calculated columns as below to get it:

Fiscal Year Quarter = 
'Table'[FY]
    & IF (
        'Table'[Month] IN { "Oct", "Nov", "Dec" },
        "Q1",
        IF (
            'Table'[Month] IN { "Jan", "Feb", "Mar" },
            "Q2",
            IF ( 'Table'[Month] IN { "Apr", "May", "Jun" }, "Q3", "Q4" )
        )
    )
Flag = 
VAR _count =
    CALCULATE (
        COUNT ( 'Table'[Fiscal Year Quarter] ),
        FILTER (
            'Table',
            'Table'[Fiscal Year Quarter] = EARLIER ( 'Table'[Fiscal Year Quarter] )
                && 'Table'[Amount] > 0
        )
    )
RETURN
    IF ( _count = 3, "True", "False" )

yingyinr_0-1669084008920.png

Best Regards

Thanks for your time. its worked .

 

Thanks,

A Joshi

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.