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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Help on DAX

Hi,

 

Can someone help me on DAX please ? I am trying get sales data for last 12 month (Rolling 12). I am tring to create a calculated column and as output I want when the PO is in rolling 12 months it will show only rolling 12 months sales data but when it is false it will show all the sales data in my model

 

Last12 =
IF (
'F_SALES_LINES'[PO_Date] <= EOMONTH ( NOW (), -12 )
|| 'F_SALES_LINES'[PO_Date] >= EOMONTH ( NOW (), 0 ),
FALSE(),
TRUE()
)
 
Outcome expected:
True = True
False = True + False
 
Thanking in advance !
 
3 REPLIES 3
Greg_Deckler
Super User
Super User

I think that you are close except I would do this:

 

Last12 =
IF (
'F_SALES_LINES'[PO_Date] > EOMONTH ( NOW (), -13 )
TRUE(),
FALSE()
)
 
If this does not solve your problem, then there is not enough information presented. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Great Thanks Greg,

 

How about when the condition does not meet and out come is False however when I filter in the report view I want to show the data as

True = When condition is True data

False = When condition is False (True + False togther will represent False)

 

Any idea how I can get this please ?

Sorry @Anonymous , didn't follow that.


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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

Top Solution Authors