Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

DAX unpivot

Hi 

 

In the DAX formula I would like to have the effect of a column that identify the "transaction"/accounting type.

the column would contain eg Gross UPR movement, GrossPremium and RIIBNRMove next to the relevant rows.

 

please help! 🙂

 

 

  • HI  Anonymous 

    You could try this formula:

    Table = 
    UNION( 
    SELECTCOLUMNS(FACT_Sales,"ProductName",RELATED(DIM_Product[ProductName]),"AccPeriodMonth",RELATED(DIM_AccountingPeriod[AccPeriodMonth]),"Companyname",RELATED(DIM_Company[CompanyName]),"TransactionType","Sales","Amount",[SalesAmount]),
    
    SELECTCOLUMNS(FACT_CostOfSales,"ProductName",RELATED(DIM_Product[ProductName]),"AccPeriodMonth",RELATED(DIM_AccountingPeriod[AccPeriodMonth]),"Companyname",RELATED(DIM_Company[CompanyName]),"TransactionType","CostOfSales","Amount",[CostOfSalesAmount]),
    
    SELECTCOLUMNS(FACT_AdminCosts,"ProductName",RELATED(DIM_Product[ProductName]),"AccPeriodMonth",RELATED(DIM_AccountingPeriod[AccPeriodMonth]),"Companyname",RELATED(DIM_Company[CompanyName]),"TransactionType","AdminCosts","Amount",[AdminCosts]
    
    ))

     

    result:

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin

8 Replies