Forum Discussion

KV2022's avatar
KV2022
Icon for Helper II rankHelper II
4 years ago
Solved

difference between to fact table columns based on conditions involving a fact and dim table

Hi , am new to power bi. can anyone help with this? I need to find a difference between two date columns in fact table based on a flag in the fact table and one column in dimension table. This needs...
  • amitchandak's avatar
    4 years ago

    KV2022 , If both dates are in Fact, use related(Dim[Date]) if date is in dimension

     

    Calculate(Sumx(Table, Datediff([Date1], [Date2], day) , filter(Table,Table[Col] = "ABC"), Filter(Dim, Dim[Col] ="ABC") )

     

    You can use Averagex in place of sumx