Forum Discussion
Calculated Measure - Multiple IF for Variable Targets
Hi aasheesh1,
Are you going to create two slicers on table 'Pipeline Created When Mapping Users' based on column [Created Last 7 Days] and [Created Last 30 Days]? And you have create a relationship between table 'Pipeline Created When Mapping Users' and table 'Pipeline Table', right? So your requirement is like two combine column [Created Last 7 Days] and [Created Last 30 Days] into a single column and then set a slicer based on the combined column, right?
You can use Unpivot columns to turn column to rows, click Query Editor-> Transform-> Unpivot Columns, after close&applied, then you can create a measure like formula below, the DAX is just a pattern for your reference because I don't know your specific expected result.
result =
IF (
SELECTEDVALUE ( Pipeline_Table[Combined_Column] ) = "Created Last 7 Days",
CALCULATE (
SUM ( Pipeline_Table[Value USD] ) / 52,
FILTER ( Pipeline_Table, Pipeline_Table[value] = "Last 7 Days" )
),
IF (
SELECTEDVALUE ( Pipeline_Table[Combined_Column] ) = "Created Last 30 Days",
CALCULATE (
SUM ( Pipeline_Table[Value_USD] ) / 12,
FILTER ( Pipeline_Table, Pipeline_Table[value] = "Last 30 Days" )
)
)
)
Regards,
Jimmy Tao
Hi v-yuta-msft,
Thank you for your reply.
The slicer I would like to use is from the "unique tables" .. which links to the Pipeline Created When Mapping Users"
Is there a way to link the unique table to the pipeline table without using the unpivot option on the pipeline table? Like by adding a custom column or something else? Unpivot columns increases the number of rows by a lot, which I would want to avoid.
Sorry i'm pretty new to this. Appreciate all the help.
Thanks,
Ash