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
icassiem
Post Patron
Post Patron

Last X-Axis Point Data Label flexible for quarter and Period

Hi,

 

I have this datalable for my last point working on period/month only but when the user drills up to quarter, then it does not work

I have this datalabel on the Y-Axis value for budget by month, and this label was to show the variance to total budget on the budget y-axis

 

LastDataPointLabelTarget =
var DateLast = EOMONTH(calculate(max(Calc_SpecialDates[Date]), filter(allselected(Calc_SpecialDates),Calc_SpecialDates[Period]="FYTD_Full")),0)
var DateSelected = EOMONTH(Sales[Date],0)
var SalesTargetFull = calculate(SUM(Sales[Target]),REMOVEFILTERS(Calc_SpecialDates),Calc_SpecialDates[Period] = "FYTD_Full")
var SalesActualFull = calculate(SUM(Sales[Actual]),REMOVEFILTERS(Calc_SpecialDates),Calc_SpecialDates[Period] = "FYTD_Full")
var Result =
 if(DateLast = DateSelected,
   if(RevenueActualFull=0,0,(SalesActualFull/SalesTargetFull))
 )
Return
  Result
 
Please help me make this calculation flexible to be able to drill up and down between quarter and period
 
Regards
1 ACCEPTED SOLUTION

Hi, @icassiem 

I'm currently using the date column, and the default hierarchy is shown in the following image:

vjianpengmsft_0-1733980907210.png

You should understand the following dax expression correctly:

QUARTER(MAXX(ALL(Calc_Calendar[Date]),Calc_Calendar[Date])) = MAX(Calc_Calendar[DateFinQuarter])

Here it will be determined whether the quarter of the current maximum date is equal to the quarter of the current axis.

The QUARTER function returns a number. You should adjust this judgment expression according to your actual situation.

If you can provide some data or pbix that doesn't contain sensitive information, and describe the results you expect, it will help me write a suitable DAX expression for you.

 

Best Regards

Jianpeng 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

5 REPLIES 5
v-jianpeng-msft
Community Support
Community Support

Hi, @icassiem 

You can use isinscope to determine which drill-down level the current user is at, and then execute the corresponding calculation logic. Here is my sample data:

vjianpengmsft_0-1733899504684.png

vjianpengmsft_1-1733899514574.png

First, I use the following variable to determine whether the current quarter is the largest quarter:

VAR Quater = QUARTER(MAXX(ALL('Table'[Date]),'Table'[Date])) = MAX('Table'[Date].[QuarterNo])

 I use the following command to determine when the user drills down to the quarter, execute the corresponding logic, if not, then execute other logic.
Please note that your date column needs to have a hierarchical structure.

IF(
        ISINSCOPE('Table'[Date].[Quarter]) && Quater, 
        IF(
            SalesActualPeriod = 0, 
            0, 
            SalesActualPeriod / SalesTargetPeriod
        ), 
        Result
    )

The results are as follows:

vjianpengmsft_2-1733899767810.png

 

vjianpengmsft_4-1733899793997.png

 

If you have any questions or need additional support, please let us know. We are happy to continue to assist you.
Thanks for your patience and we look forward to hearing from you.

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Thank You both @v-jianpeng-msft  @TomMartens 

@v-jianpeng-msft 

i created the date hierarchy on calc_date dimension but i am battling

 

Test2 =

var QUATER = QUARTER(MAXX(ALL(Calc_Calendar[Date]),Calc_Calendar[Date])) = MAX(Calc_Calendar[DateFinQuarter])
var DateLast = EOMONTH(calculate(max(Calc_SpecialDates[Date]), filter(allselected(Calc_SpecialDates),Calc_SpecialDates[Period]="FYTD_Full")),0)
var DateSelected = EOMONTH(Sales[Date],0)

var Result =
IF(
    //ISINSCOPE(Calc_Calendar[DateFinQuarter]) && QUATER,
      ISINSCOPE(Calc_Calendar[Date]) && QUATER,            
1
  //   if(DateLast = DateSelected,
   //      1           //if(SalesActualFull=0,0,(SalesActualFull/SalesTargetFull))
    //,2)
,3)
RETURN  Result
 
the ISINSCOPE seems to always be false as it return the value 3 all the time
 
icassiem_0-1733924411259.png

 

Please Help

Hi, @icassiem 

I'm currently using the date column, and the default hierarchy is shown in the following image:

vjianpengmsft_0-1733980907210.png

You should understand the following dax expression correctly:

QUARTER(MAXX(ALL(Calc_Calendar[Date]),Calc_Calendar[Date])) = MAX(Calc_Calendar[DateFinQuarter])

Here it will be determined whether the quarter of the current maximum date is equal to the quarter of the current axis.

The QUARTER function returns a number. You should adjust this judgment expression according to your actual situation.

If you can provide some data or pbix that doesn't contain sensitive information, and describe the results you expect, it will help me write a suitable DAX expression for you.

 

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

 

 

Thank you; I battled for hours and needed to move on as I have a deadline and placed a kpi card rather. Thank You

TomMartens
Super User
Super User

Hey @icassiem ,

 

please create a pbix that contains sample data, but still reflects your semantic model (tables, relationships, calculated columns, and measures). Upload the file to Onedrive, Google Drive, or Dropbox, and share the link.

Do not forget to explain the expected result behavior based on the data you provide.

 

Regards,

Tom



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

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.