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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Emelie20
Frequent Visitor

I have 2 Date columns in fact table and need to evaluate Boolean value

I have a fact table with 2 date columns, (OrderDate and ShipDate).

 

Emelie20_0-1643286775149.png

 

 

I would like to be able to get the count of "False" and "True" from Status column and present the output in one view like below.

 

Emelie20_1-1643286901712.png

 

 

I was able to achieve the one below:

 

Emelie20_2-1643286966493.png

But I am having challenges appending the ShipDate next to this.

 

I have looked up how to use "USERELATIONSHIP" but it seems it applies to rows that contain figures.

 

 

 

 

 

StatusOrderDateShipDate
FALSE12/25/202112/25/2021
FALSE9/11/20219/18/2021
FALSE8/21/20218/21/2021
FALSE12/11/202112/18/2021
TRUE12/25/202112/25/2021
TRUE11/20/202111/27/2021
FALSE1/22/20221/22/2022
FALSE10/2/202110/2/2021
FALSE12/11/202112/25/2021
TRUE12/4/202112/11/2021
TRUE10/30/202111/6/2021
TRUE1/22/20221/22/2022
FALSE12/4/202112/11/2021
FALSE1/0/19001/0/1900
FALSE1/22/20221/22/2022
2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Emelie20 , Join both the dates with a date table one join will active another will be inactive

then use date from date on row or matrix

 

countrows(Table) // for the date joined as active  assume order date

 

use this measure for inactive join

calculate(countrows(Table) , userelationship('Date'[Date], Table[ShipDate]))

 

 

use these measure in visual

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

Anonymous
Not applicable

Hi @Emelie20 ,

 

From the screemshot with the result you want, I think you want to count days before weekending per category level1:OrderDate and ShipDate, level2: True and False. 1/0/1900 is not in correct date type, please change it to 1/1/1900.

If you want to add OrderDate and ShipDate as category in matrix column, you need to transform your table by Unpivot. In Power Query Editor, select OrderDate and ShipDate columns and use Unpivot.

For reference: Unpivot columns

Create an unrelated weekending table by dax.

WeekEnding = 
VAR _DATE = ADDCOLUMNS(CALENDAR(DATE(2022,01,01),DATE(2022,01,22)),"WEEKDay",WEEKDay([Date]))
RETURN
SUMMARIZE(FILTER(_DATE,[WEEKDay]=7),[Date])

Then create a measure.

Measure = 
VAR _MAXDATEBEFORE =  CALCULATE(MAX(WeekEnding[Date]),FILTER(ALL(WeekEnding),WeekEnding[Date]<MAX(WeekEnding[Date])))
RETURN
CALCULATE(COUNT('Table'[Value]),FILTER('Table','Table'[Value]<=MAX(WeekEnding[Date])&&'Table'[Value]>_MAXDATEBEFORE))+0

Build a matrix.

1.png

 

Best Regards,
Rico Zhou

 

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

2 REPLIES 2
Anonymous
Not applicable

Hi @Emelie20 ,

 

From the screemshot with the result you want, I think you want to count days before weekending per category level1:OrderDate and ShipDate, level2: True and False. 1/0/1900 is not in correct date type, please change it to 1/1/1900.

If you want to add OrderDate and ShipDate as category in matrix column, you need to transform your table by Unpivot. In Power Query Editor, select OrderDate and ShipDate columns and use Unpivot.

For reference: Unpivot columns

Create an unrelated weekending table by dax.

WeekEnding = 
VAR _DATE = ADDCOLUMNS(CALENDAR(DATE(2022,01,01),DATE(2022,01,22)),"WEEKDay",WEEKDay([Date]))
RETURN
SUMMARIZE(FILTER(_DATE,[WEEKDay]=7),[Date])

Then create a measure.

Measure = 
VAR _MAXDATEBEFORE =  CALCULATE(MAX(WeekEnding[Date]),FILTER(ALL(WeekEnding),WeekEnding[Date]<MAX(WeekEnding[Date])))
RETURN
CALCULATE(COUNT('Table'[Value]),FILTER('Table','Table'[Value]<=MAX(WeekEnding[Date])&&'Table'[Value]>_MAXDATEBEFORE))+0

Build a matrix.

1.png

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Emelie20 , Join both the dates with a date table one join will active another will be inactive

then use date from date on row or matrix

 

countrows(Table) // for the date joined as active  assume order date

 

use this measure for inactive join

calculate(countrows(Table) , userelationship('Date'[Date], Table[ShipDate]))

 

 

use these measure in visual

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors