Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a problem with my DAX, Let me try to clear the scenario, I am creating a template for my report.
I am using Switch Cases to place values Calculation Daxs in my table. But I want Quarter Variance from my templet table (pic is below), So I am trying to create a DAX of Quarter Variance in which I want the Variance of *Last 2 Quarters in my Table column "Variance Quarter" (I am using switch case for that). I am unable to get values from Quarters.
(Note I am trying to get a variance of the Last 2 quarters which means if 2023 is selected it will get a variance of Q3 - Q2)
My Variance DAX:
MemberCount(Quarter Variance) =
SUMX(
SUMMARIZE(
'Member Group DC - Calendar',' Member Group DC - Calendar'[ColumnInUse]),
var quat =
CALCULATE([membercountHistory],FILTER('Member Group DC - Calendar','Member Group DC - Calendar'[ColumnInUse] = "Q4"))
var quat_1 =
CALCULATE([membercountHistory],FILTER('Member Group DC - Calendar','Member Group DC - Calendar'[ColumnInUse] = "Q3"))
var vari = quat - quat_1
return
vari
)
My Switch Case:
Templet case =
Var mmcount = [membercountHistory]
Var selectvalue = SELECTEDVALUE( 'Member Group DC - Calendar'[order])
var ytdvariance = [membercountHistory] - [LY_membercountHistory]
var lastyear = [MemberCount(LYYTD)]
var quarter2 = [MemberCount(Quarter Variance)]
VAR result_print =
SWITCH (
selectvalue,
7,ytdvariance,
8,lastyear,
6,quarter2,
mmcount
)
My Visual
Hi @Aazam,
It seems like you are not using the separate calendar table in your data model which has relationship with your fact table. Is that right? I think using the calender table and time intelligence functions will simplify your task.
User | Count |
---|---|
22 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
25 | |
12 | |
11 | |
7 | |
6 |