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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
byr10112
Employee
Employee

Measure conditional on another column

I have a table that shows the renewal dates of contracts, where I have a column called Renewal Date. I have a separate table called Calendar, where I have the dates and the corresponding fiscal year codes. Below is what the calendar table looks like:

DayFiscal Year
28/06/2023FY23
29/06/2023FY23
30/06/2023FY23
01/07/2023FY24

 

Below is what the renewals table looks like:

Account IDRenewal Date
100128/06/2023
100230/06/2023
100302/07/2023

 

I'm trying to calculate the number of renewals that fall into FY23. Is there a way to create such a measure on the Renewals table?

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

Hi @byr10112 ,

Please create a measure with below dax formula and add it to card visual:

Measure =
VAR cur_fiscal = "FY23"
VAR first_day =
    CALCULATE (
        FIRSTDATE ( 'Calendar'[Day] ),
        'Calendar'[Fiscal Year] = cur_fiscal
    )
VAR last_day =
    CALCULATE ( LASTDATE ( 'Calendar'[Day] ), 'Calendar'[Fiscal Year] = cur_fiscal )
VAR tmp =
    FILTER (
        ALL ( Renewals ),
        [Renewal Date] >= first_day
            && [Renewal Date] <= last_day
    )
VAR ctn =
    CALCULATE ( DISTINCTCOUNT ( Renewals[Account ID] ), tmp )
RETURN
    ctn

vbinbinyumsft_0-1664269136707.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
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-binbinyu-msft
Community Support
Community Support

Hi @byr10112 ,

Please create a measure with below dax formula and add it to card visual:

Measure =
VAR cur_fiscal = "FY23"
VAR first_day =
    CALCULATE (
        FIRSTDATE ( 'Calendar'[Day] ),
        'Calendar'[Fiscal Year] = cur_fiscal
    )
VAR last_day =
    CALCULATE ( LASTDATE ( 'Calendar'[Day] ), 'Calendar'[Fiscal Year] = cur_fiscal )
VAR tmp =
    FILTER (
        ALL ( Renewals ),
        [Renewal Date] >= first_day
            && [Renewal Date] <= last_day
    )
VAR ctn =
    CALCULATE ( DISTINCTCOUNT ( Renewals[Account ID] ), tmp )
RETURN
    ctn

vbinbinyumsft_0-1664269136707.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_ Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

parry2k
Super User
Super User

@byr10112 what defines upcoming? 

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

In FY23

parry2k
Super User
Super User

@byr10112 set the relationship between date table and renewal table on the date column and then add following measure:

 

Renewal Count = COUNTROWS ( RenewalTable )

 

In a table visual, use FY from the Date table and above measure and that will do it.

 

 

Follow us on LinkedIn and YouTube.gif to our YouTube channel

I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make effort to give Kudos to whoever helped to solve your problem. It is a token of appreciation!

 

Visit us at https://perytus.com, your one-stop shop for Power BI-related projects/training/consultancy.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

In the table I am using, I also have renewals scheduled for the next fiscal years as well. I just want to be able to flag the accounts with upcoming renewals

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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