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
Oki
Helper I
Helper I

Default current quarter, and display other quarter

Hi team,


i'm trying to display total sales target of the current quarter (Q2) using card,
but also if i choose another month (ex : August), it will show total quarter target in that month (Q3)


**I used this measure and it show the first quarter not the current quarter as default,

TargetQuarter =
VAR _q = MIN(MASTER[Quarter Column])
return
CALCULATE(SUM(MASTER[Sales Target]), FILTER(ALL(MASTER),MASTER[Quarter Column]=_q))


**If i used this measure, the default will show current quarter, but if i click June it will show that month target not the Q2 target, and if i choose August it will give blanks result

Var _Quarter = QUARTER(TODAY())
return
CALCULATE(SUM(MASTER[Sales Target]),(MASTER[QuarterColumn]=_Quarter)

 

please help with my measure
thankyou

1 ACCEPTED SOLUTION
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1681242356274.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

View solution in original post

5 REPLIES 5
Oki
Helper I
Helper I

@amitchandak  
i have column chart that show target in every month,

 

Oki_6-1681197556061.png

 

 with this detail :

 

_DATE

TARGET

1-Jan-2023

20

2-Jan-2023

10

16-Feb-2023

40

20-Apr-2023

50

22-Apr-2023

10

15-May-2023

20

2-Jun-2023

40

5-Jun-2023

30

12-Jul-2023

60

25-Aug-2023

10


i need the visual in 1 card that shows this quartal target (Q2) it means the card will show 150,

Oki_8-1681198017896.png

 

when i click Jul-23 on column chart, the card will show 70 (Q3 target in total)

Oki_5-1681197525191.png

 

Hi,

You may download my PBI file from here.

Hope this helps.

Untitled.png


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1681242356274.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

@CNENFRNL 
thankyou 😊

amitchandak
Super User
Super User

@Oki , Try like

 

QTD Today =
var _max = today()
var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

QTD Yesterday =
var _max = today()-1
var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

LQTD Today =
var _max = Date(year(today()), Month(Today())-3, day(today()))
var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

LYQTD Today =
var _max = Date(year(today())-1, Month(Today()), day(today()))
var _min = eomonth(_max,-1* if( mod(Month(_max),3) =0,3,mod(Month(_max),3)))+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

This Qtr Today =
var _today = today()
var _max = eomonth(_today, if( mod(Month(_today),3) =0,0,3-mod(Month(_today),3)))
var _min = eomonth(_max,-3)+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

Last Qtr Today =
var _today = today()
var _max = eomonth(_today, -1*if( mod(Month(_today),3) =0,3,mod(Month(_today),3)))
var _min = eomonth(_max,-3)+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

Same Qtr Last Year Today =
var _today = today()
var _max = eomonth(eomonth(_today, if( mod(Month(_today),3) =0,0,3-mod(Month(_today),3))),-12)
var _min = eomonth(_max,-3)+1
return
CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

First Qtr This year Today =
var _min = eomonth(today(),-1*month(Today()))+1
var _max = eomonth(_min,2)
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

Last Qtr Last year Today =
var _max = eomonth(today(),-1*month(Today()))
var _min = eomonth(_max,-3)+1
return CALCULATE([Net], FILTER('Date','Date'[Date] >=_min && 'Date'[Date] <= _max))

 

Try - https://medium.com/chandakamit/cheat-sheet-power-bi-time-intelligence-formulas-using-today-654f26e27...

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.