Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
johankent30
Helper I
Helper I

Help... Variable Column Data

I have a rather complicated project that I have undertaken and am stuck. I want to be able to segment accounts receivable data by collections and sales orders. Collections data is coming from a table called AR and sales orders are coming from a input parameter calles Sales Orders. Another twist is that I want the collections data to be variable based on the Scenario that is selected. So if the "Due Date" scenario is selected the value should be NetAR based on the due date column. But if the scenario selected is "DOS" then the Forecasted Paid Date column should be used which is the due date + the AR parameter. The end result would be the Goal column. 

 

I tried using columns with IF statements but that is not working because the Parameters are not able to be changed. I also tried using a measure, but I don't know how to segment the measure so that the value is different based on if the row category is collections or sales order. 

 

Any thoughts?

 

 

cc.JPG

1 ACCEPTED SOLUTION
v-juanli-msft
Community Support
Community Support

Hi @johankent30 

In Edit queries, merge queries to a new query,

5.png

Remove "Date" column, expand "AR.NetAR", "AR.Due Date", "AR.Forecasted Paid Date" columns,

unpivot columns for "AR.Due Date", "AR.Forecasted Paid Date" columns,

rename columns' name: "Value"-> "date value", "Attribute"->"date type",

 

6.png

Close&&apply

Create measures in "Merge1" table

Measure =
SWITCH (
    SELECTEDVALUE ( Scenario[Scenario] ),
    "Due Date", CALCULATE (
        SUM ( Merge1[AR.NetAR] ),
        FILTER ( Merge1, Merge1[date type] = "AR.Due Date" )
    ),
    "Dos", CALCULATE (
        SUM ( Merge1[AR.NetAR] ),
        FILTER ( Merge1, Merge1[date type] = "AR.Forecasted Paid Date" )
    )
)

Measure 2 = IF(MAX(Merge1[Subcategory])="collections",[sales order parameter],[Measure])

4.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-juanli-msft
Community Support
Community Support

Hi @johankent30 

Create a measure

Measure 3 = IF(HASONEVALUE(Merge1[date value]),[Measure 2],SUMX(Merge1,[Measure 2]))

6.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-juanli-msft Can you take a look at this problem that I've ran into with the dates on the model you helped me on?

https://community.powerbi.com/t5/Desktop/Create-new-table-with-row-for-every-day/m-p/758107#M365353

 

Thank you!!!

@v-juanli-msft You are a life saver! Thank you again!

v-juanli-msft
Community Support
Community Support

Hi @johankent30 

In Edit queries, merge queries to a new query,

5.png

Remove "Date" column, expand "AR.NetAR", "AR.Due Date", "AR.Forecasted Paid Date" columns,

unpivot columns for "AR.Due Date", "AR.Forecasted Paid Date" columns,

rename columns' name: "Value"-> "date value", "Attribute"->"date type",

 

6.png

Close&&apply

Create measures in "Merge1" table

Measure =
SWITCH (
    SELECTEDVALUE ( Scenario[Scenario] ),
    "Due Date", CALCULATE (
        SUM ( Merge1[AR.NetAR] ),
        FILTER ( Merge1, Merge1[date type] = "AR.Due Date" )
    ),
    "Dos", CALCULATE (
        SUM ( Merge1[AR.NetAR] ),
        FILTER ( Merge1, Merge1[date type] = "AR.Forecasted Paid Date" )
    )
)

Measure 2 = IF(MAX(Merge1[Subcategory])="collections",[sales order parameter],[Measure])

4.png

Best Regards
Maggie

 

Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-juanli-msft  Wow thanks for the help! One issue that I ran into with your example file is that the totals are not correct for Measure 2. Is there a way to make the totals show the correct sum based on each column? Thanks again for the help, what you did is awesome!!

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.