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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Help with average and function If

Hi mates, i need help with a problem, I want to solve this. In my work i need diferents scenarios like Half of the year, a quarter, etc. When I need to see the report in Quarter i need only a media, but if I want to see in half i need the media of sixth months, and when I selected months the information must be in real format (This is that i have), anyone can help me with this problem, please? The database is the next: 

SebastianCM27_0-1634594848542.png

 

1 REPLY 1
amitchandak
Super User
Super User

@Anonymous , You need half-year or 6 month ?

 

example for QTR

QTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESQTD(('Date'[Date])), Filter(Sales, Sales[Column] = "Media") )

 

last 6 month

 

Rolling 6 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-6,MONTH)

, Filter(Sales, Sales[Column] = "Media") )

 

 

for half year intelligence have columns like

 

Start Year = STARTOFYEAR('Date'[Date],"12/31")
Half = Half = if(datediff([start year],[Date],month)<6,1,2)
Half Year = [Start Year]*100 + [Half]
Half Year Rank = RANKX(all('Date'),'Date'[Half Year Start],,ASC,Dense)

 

 

and measures, add filter for media
This Half Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Half Year Rank]=max('Date'[Half Year Rank])))
Last Half Year = CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Half Year Rank]=max('Date'[Half Year Rank])-1))

)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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 community update carousel

Fabric Community Update - June 2025

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