Forum Discussion
Stuznet
7 years agoHelper V
Calculate Column With Filters
Hi guys, I'm struggling with power bi DAX function. I have table consists of IDs, Plan Month, Plan Year, SavedDate. Back in Excel, I created 2 fields month and Plan Start manually. ...
- 7 years ago
hi, Stuznet
You can try to use this formula
AprilStartPlan = SWITCH ( TRUE (), MAX ( DateTable[month] ) = "April", CALCULATE ( COUNT ( Data[ID] ), FILTER ( Data, [Plan Month] = "Apr" && [Plan Year] = "2018" && [SavedDate] = "March" ) ), MAX ( DateTable[month] ) = "March", CALCULATE ( COUNT ( Data[ID] ), FILTER ( Data, [Plan Month] = "Mar" && [Plan Year] = "2018" && [SavedDate] = "March" ) ) )Result:
here is pbix, please try it.
https://www.dropbox.com/s/gdwrikrf2gkih4h/Calculate%20Column%20With%20Filters.pbix?dl=0
By the way, your error that one ) is missing, there should be two ")" in this.
Best Regards,
Lin
v-lili6-msft
7 years agoCommunity Support
hi, Stuznet
You can try to use this formula
AprilStartPlan =
SWITCH (
TRUE (),
MAX ( DateTable[month] ) = "April", CALCULATE (
COUNT ( Data[ID] ),
FILTER (
Data,
[Plan Month] = "Apr"
&& [Plan Year] = "2018"
&& [SavedDate] = "March"
)
),
MAX ( DateTable[month] ) = "March", CALCULATE (
COUNT ( Data[ID] ),
FILTER (
Data,
[Plan Month] = "Mar"
&& [Plan Year] = "2018"
&& [SavedDate] = "March"
)
)
)Result:
here is pbix, please try it.
https://www.dropbox.com/s/gdwrikrf2gkih4h/Calculate%20Column%20With%20Filters.pbix?dl=0
By the way, your error that one ) is missing, there should be two ")" in this.
Best Regards,
Lin
Stuznet
7 years agoHelper V
Thank you so much v-lili6-msftGreg_Deckler it worked :)