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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Jack00711
Regular Visitor

DAX formula to Ignore Month from Month Year filter for a measure

Hello Everyone,

 

I have 2 tables, Date and FACT table as attached below : 

DATE :

Date Month Year Fiscal Start Date Fiscal End Date Fiscal Year
1/04/2022 Apr-221/04/202231/03/20232022/23
2/04/2022 Apr-221/04/202231/03/20232022/23
1/05/2022 May-221/04/202231/03/20232022/23
2/05/2022May-221/04/202231/03/20232022/23
1/05/2023May-231/04/202331/03/20242023/24
2/05/2023May-231/04/202331/03/20242023/24
1/06/2023Jun-231/04/202331/03/20242023/24
2/06/2023Jun-231/04/202331/03/20242023/24



FACT :

Date Division Value
1/04/2022A1
1/04/2022B2
1/04/2022C3
1/05/2023A4
1/05/2023B5
1/05/2023C6



I am using "Month Year" column in the filter. So I am getting correct value when selected April 2022 or May 2023. I want to show the value according to fiscal year and month value can be ignored.

I am using the following formula :
Metric Environment Value = CALCULATE(MAX([Value]),FILTER('Date', MIN('FACT'[Date])>= 'Date'[Fiscal Start Date] && MAX('FACT'[Date])<= 'Date'[Fiscal End Date]))
 
Does anyone have any idea, what can be done to show the correct value?
 

 

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

Hi @Jack00711 

You can refer to the following solution.

The samole data is the same as you have offered.

You sholuld have a relationship among the tables, the following picture is the relationship I have created.

vxinruzhumsft_0-1701917953069.png

Create a measure

Measure =
CALCULATE (
    MAX ( 'FACT'[Value] ),
    'FACT'[Date] >= MIN ( 'Date'[Fiscal Start Date] ),
    'FACT'[Date] <= MAX ( 'Date'[Fiscal End Date] ),
    CROSSFILTER ( 'Date'[Date], 'FACT'[Date], NONE )
)

Then put the field of the fact table and the measure to the table visual.(Note:I put the date in fact table to the table visual, not the date field in Date table)

Output

vxinruzhumsft_1-1701918200681.png

vxinruzhumsft_2-1701918248706.png

Best Regards!

Yolo Zhu

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

3 REPLIES 3
v-xinruzhu-msft
Community Support
Community Support

Hi @Jack00711 

You can refer to the following solution.

The samole data is the same as you have offered.

You sholuld have a relationship among the tables, the following picture is the relationship I have created.

vxinruzhumsft_0-1701917953069.png

Create a measure

Measure =
CALCULATE (
    MAX ( 'FACT'[Value] ),
    'FACT'[Date] >= MIN ( 'Date'[Fiscal Start Date] ),
    'FACT'[Date] <= MAX ( 'Date'[Fiscal End Date] ),
    CROSSFILTER ( 'Date'[Date], 'FACT'[Date], NONE )
)

Then put the field of the fact table and the measure to the table visual.(Note:I put the date in fact table to the table visual, not the date field in Date table)

Output

vxinruzhumsft_1-1701918200681.png

vxinruzhumsft_2-1701918248706.png

Best Regards!

Yolo Zhu

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

@Jack00711 The best approach is to add fiscal month-year for each date column and then use this new column to aggregate the data.  There are many posts on how to create a fiscal calendar or add new columns to the existing calendar to meet your fiscal period.



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.

Thank you for your reply. I have Fiscal Year and Month in the calender table as well. Issue is value is shown in the month of the value only not for all the months of the fiscal year.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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