Forum Discussion

LACEG's avatar
LACEG
New Member
10 years ago
Solved

Calculating the same value in 2 different columns

Hi All,   I am new to Power BI and think it is a great analysis tool.  I am attempting to create a report but I am facing issues (due to being new to the tool).   The intention of the report is t...
  • greggyb's avatar
    greggyb
    10 years ago
    1. It's been five hours, calm down.
    2. Here's a sample .pbix for you.

     

    You need to unpivot your import and export columns (this is done in Edit Queries). This allows a much cleaner measure setup:

     

    // DAX
    // Measures
    
    Total =
    COUNTROWS( FactShipment )
    
    Imports =
    CALCULATE(
        [Total]
        ,FactShipment[ShipmentType] = "Import"
    )
    
    Exports =
    CALCULATE(
        [Total]
        ,FactShipment[ShipmentType] = "Export"
    )