Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Could you please help me to solve the below problem. It is getting tough for me to come to conclusion on choosing the path to solve below.
Requirement
The sales of a Material are categorized over a period-by-period comparison and the actual status is determined for the current period
The following categorization is required. This comparison can be between years or quarters or months
Problem Statement
This comparison should be dynamic between years, quarters and months and the above comparisons should be built dynamically on the fly
Material Code | 2020 | 2021 | Measure | |
abc | 30 | new | ||
xyz | 15 | drop | ||
sss | 15 | 16 | existing |
Solved! Go to Solution.
Hi, @Anonymous
Try this:
Measure =
var _pre=Not(ISBLANK(SELECTEDVALUE('Table'[2020])))
var _current=Not(ISBLANK(SELECTEDVALUE('Table'[2021])))
var _if=IF(_pre=TRUE()&&_current=TRUE(),"existing",IF(_pre=TRUE()&&_current=FALSE(),"drop","new"))
return _if
Result:
Custom time-related calculations:
Sales YOY :=
VAR ValueCurrentPeriod = [Sales Amount]
VAR ValuePreviousPeriod = [Sales PY]
VAR Result =
IF (
NOT ISBLANK ( ValueCurrentPeriod )
&& NOT ISBLANK ( ValuePreviousPeriod ),
ValueCurrentPeriod - ValuePreviousPeriod
)
RETURN
Result
Sales MOM :=
VAR ValueCurrentPeriod = [Sales Amount]
VAR ValuePreviousPeriod = [Sales PM]
VAR Result =
IF (
NOT ISBLANK ( ValueCurrentPeriod )
&& NOT ISBLANK ( ValuePreviousPeriod ),
ValueCurrentPeriod - ValuePreviousPeriod
)
RETURN
Result
refer:
https://www.daxpatterns.com/custom-time-related-calculations/
If the above doesn't work for you, please consider sharing more details about it and posting expected result so it is clear on what needs to be implemented? And It would be great if there is a sample file without any sesentive information here.It makes it easier to give you a solution.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Try this:
Measure =
var _pre=Not(ISBLANK(SELECTEDVALUE('Table'[2020])))
var _current=Not(ISBLANK(SELECTEDVALUE('Table'[2021])))
var _if=IF(_pre=TRUE()&&_current=TRUE(),"existing",IF(_pre=TRUE()&&_current=FALSE(),"drop","new"))
return _if
Result:
Custom time-related calculations:
Sales YOY :=
VAR ValueCurrentPeriod = [Sales Amount]
VAR ValuePreviousPeriod = [Sales PY]
VAR Result =
IF (
NOT ISBLANK ( ValueCurrentPeriod )
&& NOT ISBLANK ( ValuePreviousPeriod ),
ValueCurrentPeriod - ValuePreviousPeriod
)
RETURN
Result
Sales MOM :=
VAR ValueCurrentPeriod = [Sales Amount]
VAR ValuePreviousPeriod = [Sales PM]
VAR Result =
IF (
NOT ISBLANK ( ValueCurrentPeriod )
&& NOT ISBLANK ( ValuePreviousPeriod ),
ValueCurrentPeriod - ValuePreviousPeriod
)
RETURN
Result
refer:
https://www.daxpatterns.com/custom-time-related-calculations/
If the above doesn't work for you, please consider sharing more details about it and posting expected result so it is clear on what needs to be implemented? And It would be great if there is a sample file without any sesentive information here.It makes it easier to give you a solution.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you so much @v-angzheng-msft for your response.
Here the material name that I'm looking for is in same table. And the year must be picked up from the date.
I will try to implement in the same manner as you suggested.
Regards,
Munna
Familiarize yourself with the DAX functions EXCEPT() and INTERSECT() and use these in your measures.
User | Count |
---|---|
85 | |
76 | |
73 | |
70 | |
56 |
User | Count |
---|---|
104 | |
99 | |
93 | |
78 | |
69 |