Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi All,
I have a dax which is looks something like this and it is working fine
MyMeasure1 = CALCULATE(
[Table],
ref_Dates[Date] >= DATE(2022,1,1),
ref_Dates[Date] <= DATE(2022,6,30)
)
MyMeasure2 = CALCULATE(
[Table1],
ref_Dates[Date] >= DATE(2022,1,1),
ref_Dates[Date] <= DATE(2022,6,30)
)
MyMeasure3 = MyMeasure1/MyMeasure2I then use measure 1 and 2 in measure 3 and measure 3 is referred on the visuals and it shows a constant line from Jan to Dec which is as expected and correct but what I want to do is, show measure 3 value only from Jan to Jun and then 0 from Jul to Dec.
I tried adding If condition in measure 3 but it is giving me error.
Please guide/help.
TIA
Solved! Go to Solution.
Hey there @jinivthakkar ! In that case you can go with this:
MyMeasure3 =
SWITCH (
TRUE (),
MONTH ( MAX( ref_Dates[Date] ) ) >= 1
&& MONTH ( MAX( ref_Dates[Date] ) ) <= 6, DIVIDE( MyMeasure1 , MyMeasure2, 0 ),
0
)
For additional help, please @ me in your reply!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
@goncalogeraldes thanks for your reply but I am getting error Cannot find name '[Date]':
I also tried a few other ways but nothing seems to work, basically my tables are not populating in the measure.
TIA
Hello there @jinivthakkar ! Try the following:
MyMeasure3 =
SWITCH (
TRUE (),
MONTH ( SELECTEDVALUE( ref_Dates[Date] ) ) >= 1
&& MONTH ( SELECTEDVALUE( ref_Dates[Date] ) ) <= 6, DIVIDE( MyMeasure1 , MyMeasure2 ),
0
)
For additional help, please @ me in your reply!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
@goncalogeraldes I tried this but this gives me a flat line or value as 0, I am not sure if SELECTEDVALUE will work, end users dont have option to select month value.
I already have a bar and line chart and just need to show existing measure only from Jan to Jun without user interaction.
Hey there @jinivthakkar ! In that case you can go with this:
MyMeasure3 =
SWITCH (
TRUE (),
MONTH ( MAX( ref_Dates[Date] ) ) >= 1
&& MONTH ( MAX( ref_Dates[Date] ) ) <= 6, DIVIDE( MyMeasure1 , MyMeasure2, 0 ),
0
)
For additional help, please @ me in your reply!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
Hi @jinivthakkar ! You can try the following:
MyMeasure3 =
SWITCH (
TRUE (),
MONTH ( ref_Dates[Date] ) >= 1
&& MONTH ( ref_Dates[Date] ) <= 6, MyMeasure1 / MyMeasure2,
0
)
Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!
You can also check out my LinkedIn!
Best regards,
Gonçalo Geraldes
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |