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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
alianazambori
Frequent Visitor

Multiple Starting and ending Year deepening on the country

Hi

 

I have the following scenario 

alianazambori_0-1711622175920.png

I must display data for each country differently. 
If I select Fiscal Year it is the same for all countries, my x-axis starts in January
If I select Crop Year, depending on the country that is selected in Country slicer, I must have the x-axis starting with July, April or October (as my Crop years are (July-June), (April-March) or (Oct-Sept)

Also, I have a visual where I have cumulated sum, from the first day to the last day that the user selects in date slicer. Let's say from 20.07.2023 to 20.03.2024
In this case, if the Fiscal year is selected this data belongs to the corresponding year 2023, respectively 2024.
But if the user selects Crop year and the Country selected has the crop year July-June, this data must belong to Year 2024.

I don't know how to build the Date Calendar table to support all these scenarios.
Thank you

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @alianazambori ,

Please have a try.

Create a measure.

Dynamic Year Start = 
VAR SelectedCountry = SELECTEDVALUE('Country'[Country])
VAR FiscalYearStart = DATE(YEAR(TODAY()), 1, 1) // Assuming Fiscal Year starts in January
VAR CropYearStartJuly = DATE(YEAR(TODAY()), 7, 1)
VAR CropYearStartApril = DATE(YEAR(TODAY()), 4, 1)
VAR CropYearStartOct = DATE(YEAR(TODAY()), 10, 1)
RETURN
    SWITCH(TRUE(),
        SelectedCountry = "Country1" && [Selection] = "CropYear", CropYearStartJuly,
        SelectedCountry = "Country2" && [Selection] = "CropYear", CropYearStartApril,
        SelectedCountry = "Country3" && [Selection] = "CropYear", CropYearStartOct,
        FiscalYearStart
    )

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

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

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

1 REPLY 1
Anonymous
Not applicable

Hi @alianazambori ,

Please have a try.

Create a measure.

Dynamic Year Start = 
VAR SelectedCountry = SELECTEDVALUE('Country'[Country])
VAR FiscalYearStart = DATE(YEAR(TODAY()), 1, 1) // Assuming Fiscal Year starts in January
VAR CropYearStartJuly = DATE(YEAR(TODAY()), 7, 1)
VAR CropYearStartApril = DATE(YEAR(TODAY()), 4, 1)
VAR CropYearStartOct = DATE(YEAR(TODAY()), 10, 1)
RETURN
    SWITCH(TRUE(),
        SelectedCountry = "Country1" && [Selection] = "CropYear", CropYearStartJuly,
        SelectedCountry = "Country2" && [Selection] = "CropYear", CropYearStartApril,
        SelectedCountry = "Country3" && [Selection] = "CropYear", CropYearStartOct,
        FiscalYearStart
    )

 

How to Get Your Question Answered Quickly - Microsoft Fabric Community

 

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

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

 

 

 

 

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!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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