Forum Discussion
Boycie92
8 years agoResolver I
Direct Query First and Last Dates
Hi I’m wondering if someone can help, I posted a topic a while ago about how to identify the First and Last Dates (link for further details): http://community.powerbi.com/t5/Desktop/First...
- 8 years ago
Then we need to create another new measure to calculate the count of productId.
Count ProductId = CALCULATE ( COUNTROWS ( PowerBiTable1 ), FILTER ( ALL ( PowerBiTable1 ), PowerBiTable1[ProductId] = MAX ( PowerBiTable1[ProductId] ) ) )And the final measure will be:
Identifier = IF ( PowerBiTable1[Count ProductId] = 1, "Unique", IF ( MIN ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[FirstTransactionDate], "First", IF ( MAX ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[LastTransactionDate], "Last", BLANK () ) ) )Thanks,
Xi Jin.
v-xjiin-msft
8 years agoSolution Sage
Then we need to create another new measure to calculate the count of productId.
Count ProductId =
CALCULATE (
COUNTROWS ( PowerBiTable1 ),
FILTER (
ALL ( PowerBiTable1 ),
PowerBiTable1[ProductId] = MAX ( PowerBiTable1[ProductId] )
)
)And the final measure will be:
Identifier =
IF (
PowerBiTable1[Count ProductId] = 1,
"Unique",
IF (
MIN ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[FirstTransactionDate],
"First",
IF (
MAX ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[LastTransactionDate],
"Last",
BLANK ()
)
)
)Thanks,
Xi Jin.
Boycie92
8 years agoResolver I
Hi v-xjiin-msft
Thanks for the help.
I have having an issue with the Identifier measure.
MIN ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[FirstTransactionDate],
"First",
IF (
MAX ( PowerBiTable1[TransactionDate] ) = PowerBiTable1[LastTransactionDate],
I get a red line at the bold parts of you formula. I looked at the error message and it says “a single value for column "" cannot be determined”
Any ideas why?
Thanks,
Boycie92