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

To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.

Reply
rajendraongole1
Super User
Super User

Filter the data based on latest Quarter in Bar chart by default

Hi

 

In report desinger i have visuals as below snapshot. but i am trying to get selected by default with latest quarter date which affects and filters the remaining visuals too.

 

is this possible to achieve?

Please suggest.

 

 

 output.png

 

 

 





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

Proud to be a Super User!





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

Hi @rajendraongole1 

As a workaround, you could create a visual to show the last quarter's data, then use this visual to reflect the another visual.

For example, the "last quarter's data" could update dynamically with my measure.

Capture1.JPGCapture2.JPGCapture3.JPGCapture4.JPG

To get this, i create a date table which has a relationship with main table.

date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "year", YEAR ( [Date] ),
    "month", MONTH ( [Date] ),
    "year quarter", FORMAT (
        [Date],
        "yyyy-q"
    )
)


Create measures

last quarter =
VAR thisquarter =
    VALUE (
        FORMAT (
            TODAY (),
            "q"
        )
    )
RETURN
    IF (
        thisquarter = 1,
        YEAR (
            TODAY ()
        ) - 1 & "-" & 4,
        YEAR (
            TODAY ()
        ) & "-" & thisquarter - 1
    )

2yearsbefore =
VAR last2 =
    DATE ( YEAR (
        TODAY ()
    ) - 2, MONTH (
        TODAY ()
    ), DAY (
        TODAY ()
    ) )
VAR quarter2 =
    VALUE (
        FORMAT (
            last2,
            "q"
        )
    )
RETURN
    IF (
        quarter2 = 1,
        YEAR (
            TODAY ()
        ) - 3 & "-" & 4,
        YEAR (
            TODAY ()
        ) - 2 & "-" & quarter2
    )


period values = CALCULATE(SUM('Table'[value]),FILTER('date','date'[year quarter]>=[2yearsbefore]&&'date'[year quarter]<=[last quarter]))

selected lastquarter = CALCULATE(SUM('Table'[value]),FILTER('date','date'[year quarter]=[last quarter])
)

Please download my pbix for details.

 

Best Regards

Maggie

Community Support Team _ Maggie Li
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

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @rajendraongole1 

As a workaround, you could create a visual to show the last quarter's data, then use this visual to reflect the another visual.

For example, the "last quarter's data" could update dynamically with my measure.

Capture1.JPGCapture2.JPGCapture3.JPGCapture4.JPG

To get this, i create a date table which has a relationship with main table.

date =
ADDCOLUMNS (
    CALENDARAUTO (),
    "year", YEAR ( [Date] ),
    "month", MONTH ( [Date] ),
    "year quarter", FORMAT (
        [Date],
        "yyyy-q"
    )
)


Create measures

last quarter =
VAR thisquarter =
    VALUE (
        FORMAT (
            TODAY (),
            "q"
        )
    )
RETURN
    IF (
        thisquarter = 1,
        YEAR (
            TODAY ()
        ) - 1 & "-" & 4,
        YEAR (
            TODAY ()
        ) & "-" & thisquarter - 1
    )

2yearsbefore =
VAR last2 =
    DATE ( YEAR (
        TODAY ()
    ) - 2, MONTH (
        TODAY ()
    ), DAY (
        TODAY ()
    ) )
VAR quarter2 =
    VALUE (
        FORMAT (
            last2,
            "q"
        )
    )
RETURN
    IF (
        quarter2 = 1,
        YEAR (
            TODAY ()
        ) - 3 & "-" & 4,
        YEAR (
            TODAY ()
        ) - 2 & "-" & quarter2
    )


period values = CALCULATE(SUM('Table'[value]),FILTER('date','date'[year quarter]>=[2yearsbefore]&&'date'[year quarter]<=[last quarter]))

selected lastquarter = CALCULATE(SUM('Table'[value]),FILTER('date','date'[year quarter]=[last quarter])
)

Please download my pbix for details.

 

Best Regards

Maggie

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

v-juanli-msft
Community Support
Community Support

Hi @rajendraongole1 

As tested, i can only have default selected value on a slicer.

Please check if the following links help:

https://community.powerbi.com/t5/Desktop/Setting-a-bar-chart-to-a-default-selection/td-p/73284

 

Best Regards

Maggie

amitchandak
Super User
Super User

@rajendraongole1, Can you explain more about this. If you filter a qtr, how can other qtr have some data, Unless they are coming from some other dimension/date?

If there two dates joined on the same date and not working. You may have to use  two date dimensions.

 

https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Hi Amit and maggie

 

Thanks for your responses.

 

Expecting, by default filtered the data based on latest quarter information on visuals along with that need to report last 2 years data, i have created one measure as below

 

able to get the 

 

measure_test =
Var currentdate= MAX(Date_FFA[period_Time_Stamp])
VAR Previousdate=DATE(YEAR(currentdate),MONTH(currentdate)-23,DAY(currentdate))
var result=
CALCULATE(DISTINCTCOUNT(table[USErid]),
FILTER(table,tablename[period_Time_Stamp]>=Previousdate && tablename[period_Time_Stamp]<=currentdate
))
return
result
 
from above able to acheive last 2 years data and count but the filter is not working.
 
any suggestions?




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

Proud to be a Super User!





Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors