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
Hello!
I have a table where I have period wise project wise finance data. I need to set up a flag (Calculated column) Active/Inactive based on the value of one column called Turnover. The condition is if there is a change (+/-) in the Turnover value for a project for last 3 months then the set the project as Active else set it Inactive. How can I write the condition?
Regards
Pia
Solved! Go to Solution.
Hi @Anonymous ,
To create a calculated column as below.
flag =
VAR last3month =
EDATE ( TODAY (), -3 )
VAR disc =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Turnover ] ),
FILTER (
'Table',
'Table'[project_id] = EARLIER ( 'Table'[project_id] )
&& 'Table'[Date] >= last3month
&& 'Table'[Date] <= TODAY ()
)
)
RETURN
IF (
'Table'[Date] >= last3month
&& 'Table'[Date] <= TODAY (),
IF ( disc > 1, "Active", "Inactive" ),
BLANK ()
)
Hi,
Why do you want that as a calculated column and not a measure?
Hi @Anonymous ,
To create a calculated column as below.
flag =
VAR last3month =
EDATE ( TODAY (), -3 )
VAR disc =
CALCULATE (
DISTINCTCOUNT ( 'Table'[Turnover ] ),
FILTER (
'Table',
'Table'[project_id] = EARLIER ( 'Table'[project_id] )
&& 'Table'[Date] >= last3month
&& 'Table'[Date] <= TODAY ()
)
)
RETURN
IF (
'Table'[Date] >= last3month
&& 'Table'[Date] <= TODAY (),
IF ( disc > 1, "Active", "Inactive" ),
BLANK ()
)
Hello @v-frfei-msft
the data type for project nr. has changed to integer to string. and now the formula doesnt work. how can i change the formula?
1. Create Quick measure as shown in the picture.
2. Pass only Dates Dim/Calendar table date as Date value
3. Value field as 'Turnover
4. Power BI Creates a Measure [Turnover MoM%]
Note: If you dont have CALENDAR table, manully derive the value MoM%
5. using this Measure derive your desired calculated column as below:
StatusFlag = IF([Turnover MoM%] = 0,"Inactive", "Active")
Hi @Anonymous
But where can I define that comapre the values for only last 3 months?
Regards
Pia
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.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 20 | |
| 17 |
| User | Count |
|---|---|
| 70 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |