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
SOppeneer
Frequent Visitor

Last date in slicer regardless of visual by month

Hi All,

 

I hope you can help me, as it seems I can't figure this one out. 

 

I have a report with a calendar table ('Report Calendar') that I use to filter a fact table ('Invoice Detail') on separate date columns, which is working out well so far. However, I need to obtain the last date of the selection for another calculation (here: 12/31/2018). Also that works fine, until I want to trend the measure by the month. As you can see below, the measure takes the last date of each month in the visual which is kind of expected, while I want it to apply the selection's last value of 12/31/2018 for each month. How do I achieve this?

 

The slicer takes the 'Report Calendar'[Date]. The table shows the [Date] from 'Report Calendar', and the [c. Period End (Posted)] and [c. Count Invoices (Posted)] measures from 'Invoice Detail'.

 

2021-06-23_145307.jpg

1 ACCEPTED SOLUTION
SOppeneer
Frequent Visitor

As usual, in retrospect the solution is pretty easy. Instead of trying to use the same date for both slicer and trend visual, I added another date calendar with the same range (Trend Calendar as SUMMARIZE for the Report Calendar) so that I can trend with the Trend Calendar while using the Report Calendar as slicer and for the last date of selected period. 

 

The count measure considers both the Report Calendar and the Trend Calendar. 

 

c. Count Invoices (Posted) = 
VAR dateStart = MIN('Report Calendar'[Date]) RETURN
VAR dateEnd = MAX('Report Calendar'[Date]) RETURN
VAR trendStart = MIN('Trend Calendar'[Date]) RETURN
VAR trendEnd = MAX('Trend Calendar'[Date]) RETURN

CALCULATE(
    COUNT('Invoice Detail'[Financial Doc # (Yr-CC-Doc)]), 
    FILTER(
        'Invoice Detail', 
        'Invoice Detail'[Date Posting] >= dateStart && 
        'Invoice Detail'[Date Posting] <= dateEnd &&
        'Invoice Detail'[Date Posting] >= trendStart &&
        'Invoice Detail'[Date Posting] <= trendEnd
    )
)

2021-06-24_161929.jpg2021-06-24_161952.jpg 

View solution in original post

2 REPLIES 2
SOppeneer
Frequent Visitor

As usual, in retrospect the solution is pretty easy. Instead of trying to use the same date for both slicer and trend visual, I added another date calendar with the same range (Trend Calendar as SUMMARIZE for the Report Calendar) so that I can trend with the Trend Calendar while using the Report Calendar as slicer and for the last date of selected period. 

 

The count measure considers both the Report Calendar and the Trend Calendar. 

 

c. Count Invoices (Posted) = 
VAR dateStart = MIN('Report Calendar'[Date]) RETURN
VAR dateEnd = MAX('Report Calendar'[Date]) RETURN
VAR trendStart = MIN('Trend Calendar'[Date]) RETURN
VAR trendEnd = MAX('Trend Calendar'[Date]) RETURN

CALCULATE(
    COUNT('Invoice Detail'[Financial Doc # (Yr-CC-Doc)]), 
    FILTER(
        'Invoice Detail', 
        'Invoice Detail'[Date Posting] >= dateStart && 
        'Invoice Detail'[Date Posting] <= dateEnd &&
        'Invoice Detail'[Date Posting] >= trendStart &&
        'Invoice Detail'[Date Posting] <= trendEnd
    )
)

2021-06-24_161929.jpg2021-06-24_161952.jpg 

Hi,  @SOppeneer 

Thanks for your sharing.

More people will learn new things here.

 

Best Regards,
Community Support Team _ Eason

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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.